DelphiBasics
  Home  |  Delphi .net Home  |  System NameSpace
 .NET Framework
 Namespace References

 System
 
  Array  Class 
  Boolean  Structure 
  Buffer  Class 
  Byte  Structure 
  Char  Structure 
  Console  Class 
  Convert  Class 
  DateTime  Structure 
  DayOfWeek  Enumeration 
  Decimal  Structure 
  Double  Structure 
  Enum  Class 
  Environment  Class 
  Exception  Class 
  ICloneable  Interface 
  Int16  Structure 
  Int32  Structure 
  Int64  Structure 
  Math  Class 
  Object  Class 
  OperatingSystem  Class 
  Random  Class 
  SByte  Structure 
  Single  Structure 
  String  Class 
  TimeSpan  Structure 
  UInt16  Structure 
  UInt32  Structure 
  UInt64  Structure 
  Version  Class 
 System.Collections
 System.Globalization
 System.IO

 Articles and Tutorials

 Overview of .NET
 Delphi and .NET
 Winform Applications
 ASP .Net Applications
 php Web Services
 Framework Collections
 Framework String Handling
 Framework Files and Folders


 
 
  System.String Class
 
 Description
The String class equates quite well with the StrUtils Run Time Library unit.
 
In .Net, strings are always sequences of Unicode characters - it is wrong to see them as byte arrays (Unicode characters require 2 bytes per character).
 
In .Net, strings are never updated (they are deemed immutable). Code that appears to update a string merely creates a new string instance that holds the result of the manipulation. Be wary of the performance impacts of this processing (use StringBuilder for optimal performance).
 
System.String is an oject in Delphi for .Net. When developing a .Net application, the primitive String also becomes an object - it is mapped to System.String.
 
Strings are deemed classes in .Net rather than structures because their size is variable (structures, such as DateTime, in .Net are a special case of class where their finite size allows them to be stored on the stack rather than in the heap, and hence more efficiently).
 Syntax
Constructor Create ( value : ^Char ; );
Constructor Create ( value : ^Char; startIndex : Integer; length : Integer );
Constructor Create ( c : Char; count : Length );
Constructor Create ( value : array of Char ; );
Constructor Create ( value : array of Char; startIndex : Integer; length : Integer );
Constructor Create ( value : ShortInt ; );
Constructor Create ( value : ShortInt; startIndex : Integer; length : Integer );
Constructor Create ( value : ShortInt; startIndex : Integer; length : Integer; enc : Encoding );
 Methods
Compare  Compares two specified String objects.
CompareTo  Compares the current string with another
Concat  Concatenates one or more instances of String, or the String objects
Copy  Creates a new instance of String with the same value as a specified String.
CopyTo  Copies part of a string into a section of a Char array
EndsWith  Determines if a string ends with a specified string
Equals  Determines whether two String objects have the same value.
Format  Formats numbers, datetimes and enumerations into a string
IndexOf  Finds the first index position of a string within a string
IndexOfAny  Finds the first index of any of a set of characters within a string
Insert  Inserts a string into another string, creating a new, longer string
Join  Converts a string array into a string with a separator string between each
LastIndexOf  Finds the last index position of a string within a string
LastIndexOfAny  Finds the last index of any of a set of characters within a string
PadLeft  Right aligns a string, padding to the left as appropriate
PadRight  Left aligns a string, padding to the right as appropriate
Remove  Removes a number of characters from a string
Replace  Replaces all occurences of a string with another string
Split  Parses a string into an array of substrings
StartsWith  Determines if a string starts with a specified string
SubString  Returns a section of a string
ToCharArray  Creates a character array from a string
ToLower  Converts a string to lower case
ToUpper  Converts a string to upper case
Trim  Trims specified characters from both ends of a string
TrimEnd  Trims specified characters from the end of a string
TrimStart  Trims specified characters from the start of a string

 Fields
Empty  String  Represents the empty string. This field is read-only.
 Properties
Chars  Char  Gets the character at a specified character position in this instance.
Length  Int  Gets the number of characters in this instance.
 Operators
=  Determines whether two specified String objects have the same value.
<>  Determines whether two specified String objects have different values.

 Microsoft MSDN links
 
System
System.string
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page