bugGNU Octave - Bugs: bug #34709, help strsplit isn't helpful: what...

 
 

bug #34709: help strsplit isn't helpful: what is P?

Submitted by:  Clem <clemwang>
Submitted on:  Mon 31 Oct 2011 08:52:43 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Documentation
Status: FixedAssigned to: None
Originator Name: ClemOpen/Closed: Closed
Release: 3.4.0Operating System: Mac OS

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 01 Nov 2011 04:46:53 PM UTC, comment #2:

I think you're right that the P naming was a holdover from some other implementation. I have renamed the variable P to S and rephrased the documentation to mention both S and SEP. I also added another calling form of the function to show that the STRIP_EMPTY argument is optional. These changes will show up in the 3.6 release scheduled for December 2011.

Rik <rik5>
Project Administrator
Mon 31 Oct 2011 10:06:05 PM UTC, comment #1:

OK, I now understand my confusion!

The SEP argument is REQUIRED, but the STRIP_EMPTY argument is OPTIONAL. The documentation fails to explain that.

The P is probably a holdover from the C implementation indicating a string ptr, but in the Octave world, it really means a string argument, so that the P should be replaced by S to be consistent.

So... The problem is that the usage documentation is lacking/confusing. I finally got strsplit to work.

Clem <clemwang>
Mon 31 Oct 2011 08:52:43 PM UTC, original submission:

I've seen various versions of functions similarly named to strsplit, so I have some idea of how it should work... Presumably the first argument is a string, but the documentation isn't helpful and describes the parameter as "P" but fails to describe what P is! From the error msg, I can see that it's not a string, but I can't begin to guess what it might be....

Also, looking at the Matlab documentation, it seems to suggest that the function strsplit() should work the way that I expect: the first argument is a string.

(I also notice in the documentation for the various string functions, that sometimes "s" is used for the parameter string and sometimes "str". It should be consistent.)

Here is the output that I find unhelpful:

>> strsplit('foo bar baz')

error: Invalid call to strsplit. Correct usage is:

-- Function File: [S] = strsplit (P, SEP, STRIP_EMPTY)

>> help strsplit

`strsplit' is a function from the file /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/strings/strsplit.m

-- Function File: [S] = strsplit (P, SEP, STRIP_EMPTY)
Split a single string using one or more delimiters and return a
cell array of strings. Consecutive delimiters and delimiters at
boundaries result in empty strings, unless STRIP_EMPTY is true.
The default value of STRIP_EMPTY is false.

See also: strtok

Clem <clemwang>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by clemwang (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 01 Nov 2011 04:46:53 PM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1