help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strjust


From: Ben Abbott
Subject: Re: strjust
Date: Thu, 14 Oct 2010 08:36:17 -0700

On Oct 14, 2010, at 7:03 AM, Leo Butler <address@hidden> wrote:

> On Wed, 13 Oct 2010, Ben Abbott wrote:
> 
> < On Oct 13, 2010, at 12:16 AM, Leo Butler <address@hidden> wrote:
> < 
> < > In 3.3.52+, I find the following behaviour of strjust,
> < > which appears to conflict with its description.
> < > 
> < > octave> s=sprintf("\tstring");
> < > octave> s=strjust(s,"left")
> < > s =     string
> < > octave> s=sprintf("        string");
> < > octave> s=strjust(s,"left")
> < > s = string
> < > 
> < > You can see that it is not removing leading tabs.
> < > 
> < > Leo
> < 
> < Does the description below clarify how strjust functions?
> < 
> < strjust (S)
> < strjust (S, "right")
> < Returns the text, S, justified to the right.
> < strjust (S, "left")
> < Returns left justified text.
> < strjust (S, "center")
> < Returns center justified text.
> < Null characters are replaced by spaces.
> 
> Here is the info description:
> 
>  -- Function File:  strjust (S, ["left"|"right"|"center"])
>       Shift the non-blank text of S to the left, right or center of the
>       string.  If S is a string array, justify each string in the array.
>        Null characters are replaced by blanks.  If no
>        justification is
>      specified, then all rows are right-justified. 
> 
> By comparison:
> -- Function File:  strtrim (S)
>      Remove leading and trailing blanks and nulls from S. 
> 
> And here is how each works:
> 
> octave> s=sprintf("\tstring");
> octave> strjust(s,"left")
> ans =   string
> octave> strtrim(s)
> ans = string
> 
> You see that the definition of 'blank' is inconsistent.
> 
> Leo

I've pushed the change below.

http://hg.savannah.gnu.org/hgweb/octave/rev/04c3aacbbc46

Thanks
Ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]