12.07.2015 Views

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 5: Strings 45toupper (s)Built-in FunctionReturn a copy of the string s, with each lower-case character replaced by the correspondingupper-case one; nonalphabetic characters are left unchanged. For example,toupper ("MiXeD cAsE 123")⇒ "MIXED CASE 123"do string escapes (string)Convert special characters in string to their escaped forms.Built-in Functionundo string escapes (s)Built-in FunctionConverts special characters in strings back to their escaped forms. For example, theexpressionbell = "\a";assigns the value of the alert character (control-g, ASCII code 7) to the string variablebell. If this string is printed, the system will ring the terminal bell (if it is possible).This is normally the desired outcome. However, sometimes it is useful to be able toprint the original representation of the string, with the special characters replaced bytheir escape sequences. For example,octave:13> undo_string_escapes (bell)ans = \areplaces the unprintable alert character with its printable representation.warn num to strBuilt-in VariableIf the value of warn_num_to_str is nonzero, a warning is printed for implicit conversionsof numbers to their ASCII character equivalents when strings are constructedusing a mixture of strings and numbers in matrix notation. For example,[ "f", 111, 111 ]⇒ "foo"elicits a warning if warn_num_to_str is nonzero. The default value is 1.warn str to numBuilt-in VariableIf the value of warn_str_to_num is nonzero, a warning is printed for implicit conversionsof strings to their numeric ASCII equivalents. For example,"abc" + 0⇒ 97 98 99elicits a warning if warn_str_to_num is nonzero. The default value is 0.warn single quote stringBuilt-in VariablePrint warning if a signle quote character is used to introduce a string constant.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!