Difference between revisions of "ObjectType:string"

From Lavish Software Wiki
Jump to navigation Jump to search
m (DataType:string moved to ObjectType:string)
Line 1: Line 1:
 
== Description ==
 
== Description ==
 +
{{ObjectType-Vitals|string|[[LavishScript]]|none|the stored text|[[ObjectType:mutablestring|mutablestring]]|no|const char *}}
 
A string, also known as <tt>text</tt> is a series of consecutive characters.
 
A string, also known as <tt>text</tt> is a series of consecutive characters.
  
Line 26: Line 27:
  
 
== Declaring string Variables ==
 
== Declaring string Variables ==
*Any string''' variable''' is a [[DataType:mutablestring|mutablestring]]  
+
*Any string '''variable''' is automatically a [[DataType:mutablestring|mutablestring]]  
 
*declare Food string "Pizza"
 
*declare Food string "Pizza"
 
*declare Word string script
 
*declare Word string script
 
 
  
 
== Comparing Strings ==
 
== Comparing Strings ==
Line 39: Line 38:
 
     echo We're both named fred!
 
     echo We're both named fred!
 
     }
 
     }
 
== Operates On ==
 
<tt>const char *</tt>
 
  
 
== See Also ==
 
== See Also ==
* [[LavishScript:Data Types|Data Types]]
+
* [[LavishScript:Object Types|LavishScript Object Types]]
  
 
[[Category:LavishScript]]
 
[[Category:LavishScript]]
[[Category:LavishScript Data Types]]
+
[[Category:LavishScript Object Types]]

Revision as of 20:00, 24 March 2006

Description

Object Type Vitals
string
Defined By LavishScript
Inherits none
Reduces To the stored text
Variable Object Type mutablestring
Uses Sub-Types no
C/C++ Type const char *

A string, also known as text is a series of consecutive characters.

Members

  • string Mid[position,length]: Returns a string containing the given length at the given position (1-based) of the original string
  • string Left[#]: Returns a string containing the leftmost # characters of the original string. A negative number can be used to give the leftmost (Length-#)
  • string Right[#]: Returns a string containing the rightmost # characters of the original string. A negative number can be used to give the rightmost (Length-#)
  • int Find[text]: Returns the 1-based position of a given substring in the original string, or NULL
  • int Length: Returns the length of the string
  • string Upper: Returns a string containing the original string in all upper case
  • string Lower: Returns a string containing the original string in all lower case
  • int Compare[text]: Compares this string, without regards to case, to the given text. Return value is less than 0 if the text would come before it in the dictionary, 0 if it is equal, or greater than 0 if the text would come after the string
  • int CompareCS[text]: Compares this string, with regards to case, to the given text. Return value is less than 0 if the text would come before it in the dictionary, 0 if it is equal, or greater than 0 if the text would come after the string
  • bool Equal[text]: TRUE if the string is equal to, without regards to case, the given text
  • bool NotEqual[text]: TRUE if the string is not equal to, without regards to case, the given text
  • bool EqualCS[text]: TRUE if the string is equal to, with regards to case, the given text
  • bool NotEqualCS[text]: TRUE if the string is not equal to, with regards to case, the given text
  • int Count[char]: The number of times a specific character appears in the string
  • string Token[#,separator]: "Tokenizes" the string by the given separator and returns the #th token
  • string Escape: Uses slashes to escape \, ", carriage return, line feed, tab, as well as LavishScript data sequences
  • string EscapeQuotes: Uses slashes to escape " only
  • string Replace[character,with,...]: Performs single-character replacement with any number of character pairs

Methods

(none)

Declaring string Variables

  • Any string variable is automatically a mutablestring
  • declare Food string "Pizza"
  • declare Word string script

Comparing Strings

declare name1 string "fred"
declare name2 string "george"
if ${name1.Equal[${name2}]}
   {
    echo We're both named fred!
   }

See Also