help-octave
[Top][All Lists]
Advanced

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

Re: strjust


From: Leo Butler
Subject: Re: strjust
Date: Thu, 14 Oct 2010 15:03:47 +0100 (BST)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)


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

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



reply via email to

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