Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

String class: Difference between revisions

From Catglobe Wiki
Nguyenduyan (talk | contribs)
No edit summary
Nguyenduyan (talk | contribs)
No edit summary
Line 47: Line 47:
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
}}
}}
=== <span style="color:#DF8621">'''Examples'''</span> ===
<source lang="javascript">
String a = new String ("Catglobe System Setup");
print(a.Contains("globe"));//True
print(a.IndexOf("t"));//2
print(a.IndexOf("t",5));//12
print(a.LastIndexOf("t"));//18
print(a.LastIndexOf("t",17));//12
print(a.StartsWith("c"));// False
print(a.StartsWith("c", true));// True
print(a.EndsWith("P"));// False
print(a.EndsWith("p", true));//True
print(a.ToLowerInvariant());//catglobe system setup
print(a.ToUpperInvariant());//CATGLOBE SYSTEM SETUP
</source>

Revision as of 08:32, 28 November 2017

String



The string object

Constructors

  • (string value "Value to give object") - New object with the given value

Methods

  • number CompareTo(string value "Value to compare to") - Compare to object. See ArrayConstant.OrderBy
  • number CompareToIgnoreCase(string value "Value to compare to") - Compare to object. See ArrayConstant.OrderBy
  • bool Contains(string value "Value to compare to") - Returns true if the value specified occurs in the string
  • bool EndsWith(string value "Value to compare to") - Returns true if the value specified occurs at the end of the string
  • bool EndsWith(string value "Value to compare to", bool ignoreCase "True to ignore case during comparison") - Returns true if the value specified occurs at the end of the string
  • int IndexOf(string value "Value to compare to") - Returns the 0-based index of where the value is to be found in the string, or -1
  • int IndexOf(string value "Value to compare to", int startIndex "The search starting position") - Returns the 0-based index of where the value is to be found in the string, or -1
  • int LastIndexOf(string value "Value to compare to") - Returns the 0-based index of where the value is to be found in the string, or -1
  • int LastIndexOf(string value "Value to compare to", int startIndex "The search starting position") - Returns the 0-based index of where the value is to be found in the string, or -1
  • bool StartsWith(string value "Value to compare to") - Returns true if the value specified occurs at the start of the string
  • bool StartsWith(string value "Value to compare to", bool ignoreCase "True to ignore case during comparison") - Returns true if the value specified occurs at the start of the string
  • string ToLowerInvariant() - Returns the string converted to its lower case variant using invariant culture
  • string ToString() - The string representation of the object.
  • string ToUpperInvariant() - Returns the string converted to its upper case variant using invariant culture

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.

Examples

String a = new String ("Catglobe System Setup");
print(a.Contains("globe"));//True

print(a.IndexOf("t"));//2
print(a.IndexOf("t",5));//12

print(a.LastIndexOf("t"));//18
print(a.LastIndexOf("t",17));//12

print(a.StartsWith("c"));// False
print(a.StartsWith("c", true));// True

print(a.EndsWith("P"));// False
print(a.EndsWith("p", true));//True

print(a.ToLowerInvariant());//catglobe system setup
print(a.ToUpperInvariant());//CATGLOBE SYSTEM SETUP