C# 클래스 FlatRedBall.Utilities.StringFunctions

A class containing common string maniuplation methods.
파일 보기 프로젝트 열기: vchelaru/FlatRedBall

공개 메소드들

메소드 설명
CharacterCountWithoutWhitespace ( string stringInQuestion ) : int

Returns the number of non-whitespace characters in the argument stringInQuestion.

This method is used internally by the TextManager to determine the number of vertices needed to draw a Text object.

Contains ( this listToInvestigate, string whatToSearchFor ) : bool
CountOf ( this instanceToSearchIn, char characterToSearchFor ) : int
CountOf ( this instanceToSearchIn, char characterToSearchFor, int startIndex, int searchLength ) : int
CountOf ( this instanceToSearchIn, string whatToFind ) : int

Returns the number of times that the argument whatToFind is found in the calling string.

FloatToString ( float floatToConvert, int decimalsAfterPoint ) : string

Returns a string of the float with the argument decimalsAfterPoint digits of resolution after the point.

GetCharAfter ( string stringToSearchFor, string whereToSearch ) : char

Returns the character that can be found after a particular sequence of characters.

This will return the first character following a particular sequence of characters. For example, GetCharAfter("bcd", "abcdef") would return 'e'.

GetClosingCharacter ( string fullString, int startIndex, char openingCharacter, char closingCharacter ) : int
GetDigitCount ( double x ) : int
GetFloatAfter ( string stringToSearchFor, string whereToSearch ) : float

Returns the float that can be found after a particular sequence of characters.

This will return the float following a particular sequence of characters. For example, GetCharAfter("height = 6; width = 3; depth = 7;", "width = ") would return 3.0f.

GetFloatAfter ( string stringToSearchFor, string whereToSearch, int startIndex ) : float
GetIntAfter ( string stringToSearchFor, string whereToSearch ) : int

Returns the first integer found after the argument stringToSearchFor in whereToSearch.

This method is used to help simplify parsing of text files and data strings. If stringToSearchFor is "Y:" and whereToSearch is "X: 30, Y:32", then the value of 32 will be returned.

GetIntAfter ( string stringToSearchFor, string whereToSearch, int startIndex ) : int

Returns the first integer found after the argument stringToSearchFor. The search begins at the argument startIndex.

GetLineCount ( string stringInQuestion ) : int

Returns the number of lines in a given string. Newlines '\n' increase the line count.

GetNumberAtEnd ( string stringToGetNumberFrom ) : int

Returns the number found at the end of the argument stringToGetNumberFrom or throws an ArgumentException if no number is found.

A stringToGetNumberFrom of "sprite41" will result in the value of 41 returned. A stringToGetNumberFrom of "sprite" will result in an ArgumentException being thrown.

GetStartAndEndOfLineContaining ( string contents, string whatToSearchFor, int &start, int &end ) : void
GetWordAfter ( string stringToStartAfter, StringBuilder entireString ) : string
GetWordAfter ( string stringToStartAfter, StringBuilder entireString, int indexToStartAt ) : string
GetWordAfter ( string stringToStartAfter, StringBuilder entireString, int indexToStartAt, System.StringComparison comparison ) : string
GetWordAfter ( string stringToStartAfter, string entireString ) : string
GetWordAfter ( string stringToStartAfter, string entireString, int indexToStartAt ) : string
GetWordAfter ( string stringToStartAfter, string entireString, int indexToStartAt, System.StringComparison comparison ) : string
HasNumberAtEnd ( string stringToGetNumberFrom ) : bool
IncrementNumberAtEnd ( string originalString ) : string

Increments the number at the end of a string or adds a number if none exists.

This method begins looking at the end of a string for numbers and moves towards the beginning of the string until it encounters a character which is not a numerical digit or the beginning of the string. "Sprite123" would return "Sprite124", and "MyString" would return "MyString1".

InsertSpacesInCamelCaseString ( string originalString ) : string

Inserts spaces before every capital letter in a camel-case string. Ignores the first letter.

For example "HelloThereIAmCamelCase" becomes "Hello There I Am Camel Case".

IsAscii ( string stringToCheck ) : bool
IsNumber ( string stringToCheck ) : bool
MakeCamelCase ( string originalString ) : string
MakeStringUnique ( string stringToMakeUnique, List stringList ) : string
MakeStringUnique ( string stringToMakeUnique, List stringList, int numberToStartAt ) : string
RemoveDuplicates ( List strings ) : void
RemoveDuplicates ( List strings, bool ignoreCase ) : void
RemoveNumberAtEnd ( string originalString ) : string

Removes the number found at the end of the argument originalString and returns the resulting string, or returns the original string if no number is found.

RemoveWhitespace ( string stringToRemoveWhitespaceFrom ) : string

Removes all whitespace found in the argument stringToRemoveWhitespaceFrom.

ReplaceLine ( string &contents, string contentsOfLineToReplace, string whatToReplaceWith ) : void

메소드 상세

CharacterCountWithoutWhitespace() 공개 정적인 메소드

Returns the number of non-whitespace characters in the argument stringInQuestion.
This method is used internally by the TextManager to determine the number of vertices needed to draw a Text object.
public static CharacterCountWithoutWhitespace ( string stringInQuestion ) : int
stringInQuestion string The string to have its non-witespace counted.
리턴 int

Contains() 공개 정적인 메소드

public static Contains ( this listToInvestigate, string whatToSearchFor ) : bool
listToInvestigate this
whatToSearchFor string
리턴 bool

CountOf() 공개 정적인 메소드

public static CountOf ( this instanceToSearchIn, char characterToSearchFor ) : int
instanceToSearchIn this
characterToSearchFor char
리턴 int

CountOf() 공개 정적인 메소드

public static CountOf ( this instanceToSearchIn, char characterToSearchFor, int startIndex, int searchLength ) : int
instanceToSearchIn this
characterToSearchFor char
startIndex int
searchLength int
리턴 int

CountOf() 공개 정적인 메소드

Returns the number of times that the argument whatToFind is found in the calling string.
public static CountOf ( this instanceToSearchIn, string whatToFind ) : int
instanceToSearchIn this The string to search within.
whatToFind string The string to search for.
리턴 int

FloatToString() 공개 정적인 메소드

Returns a string of the float with the argument decimalsAfterPoint digits of resolution after the point.
public static FloatToString ( float floatToConvert, int decimalsAfterPoint ) : string
floatToConvert float The float to convert.
decimalsAfterPoint int The number of decimals after the point. For example, 3.14159 becomes "3.14" if the /// decimalsAfterPoint is 2. This method will not append extra decimals to reach the argument decimalsAfterPoint.
리턴 string

GetCharAfter() 공개 정적인 메소드

Returns the character that can be found after a particular sequence of characters.
This will return the first character following a particular sequence of characters. For example, GetCharAfter("bcd", "abcdef") would return 'e'.
public static GetCharAfter ( string stringToSearchFor, string whereToSearch ) : char
stringToSearchFor string The string to search for.
whereToSearch string The string to search in.
리턴 char

GetClosingCharacter() 공개 정적인 메소드

public static GetClosingCharacter ( string fullString, int startIndex, char openingCharacter, char closingCharacter ) : int
fullString string
startIndex int
openingCharacter char
closingCharacter char
리턴 int

GetDigitCount() 공개 정적인 메소드

public static GetDigitCount ( double x ) : int
x double
리턴 int

GetFloatAfter() 공개 정적인 메소드

Returns the float that can be found after a particular sequence of characters.
This will return the float following a particular sequence of characters. For example, GetCharAfter("height = 6; width = 3; depth = 7;", "width = ") would return 3.0f.
public static GetFloatAfter ( string stringToSearchFor, string whereToSearch ) : float
stringToSearchFor string The string to search for.
whereToSearch string The string to search in.
리턴 float

GetFloatAfter() 공개 정적인 메소드

public static GetFloatAfter ( string stringToSearchFor, string whereToSearch, int startIndex ) : float
stringToSearchFor string
whereToSearch string
startIndex int
리턴 float

GetIntAfter() 공개 정적인 메소드

Returns the first integer found after the argument stringToSearchFor in whereToSearch.
This method is used to help simplify parsing of text files and data strings. If stringToSearchFor is "Y:" and whereToSearch is "X: 30, Y:32", then the value of 32 will be returned.
public static GetIntAfter ( string stringToSearchFor, string whereToSearch ) : int
stringToSearchFor string The string pattern to search for.
whereToSearch string The string that will be searched.
리턴 int

GetIntAfter() 공개 정적인 메소드

Returns the first integer found after the argument stringToSearchFor. The search begins at the argument startIndex.
public static GetIntAfter ( string stringToSearchFor, string whereToSearch, int startIndex ) : int
stringToSearchFor string The string pattern to search for.
whereToSearch string The string that will be searched.
startIndex int The index to begin searching at. This method /// will ignore any instances of stringToSearchFor which begin at an index smaller /// than the argument startIndex.
리턴 int

GetLineCount() 공개 정적인 메소드

Returns the number of lines in a given string. Newlines '\n' increase the line count.
public static GetLineCount ( string stringInQuestion ) : int
stringInQuestion string The string that will have its lines counted.
리턴 int

GetNumberAtEnd() 공개 정적인 메소드

Returns the number found at the end of the argument stringToGetNumberFrom or throws an ArgumentException if no number is found.
A stringToGetNumberFrom of "sprite41" will result in the value of 41 returned. A stringToGetNumberFrom of "sprite" will result in an ArgumentException being thrown.
Throws ArgumentException if no number is found at the end of the argument string.
public static GetNumberAtEnd ( string stringToGetNumberFrom ) : int
stringToGetNumberFrom string The number found at the end.
리턴 int

GetStartAndEndOfLineContaining() 공개 정적인 메소드

public static GetStartAndEndOfLineContaining ( string contents, string whatToSearchFor, int &start, int &end ) : void
contents string
whatToSearchFor string
start int
end int
리턴 void

GetWordAfter() 공개 정적인 메소드

public static GetWordAfter ( string stringToStartAfter, StringBuilder entireString ) : string
stringToStartAfter string
entireString StringBuilder
리턴 string

GetWordAfter() 공개 정적인 메소드

public static GetWordAfter ( string stringToStartAfter, StringBuilder entireString, int indexToStartAt ) : string
stringToStartAfter string
entireString StringBuilder
indexToStartAt int
리턴 string

GetWordAfter() 공개 정적인 메소드

public static GetWordAfter ( string stringToStartAfter, StringBuilder entireString, int indexToStartAt, System.StringComparison comparison ) : string
stringToStartAfter string
entireString StringBuilder
indexToStartAt int
comparison System.StringComparison
리턴 string

GetWordAfter() 공개 정적인 메소드

public static GetWordAfter ( string stringToStartAfter, string entireString ) : string
stringToStartAfter string
entireString string
리턴 string

GetWordAfter() 공개 정적인 메소드

public static GetWordAfter ( string stringToStartAfter, string entireString, int indexToStartAt ) : string
stringToStartAfter string
entireString string
indexToStartAt int
리턴 string

GetWordAfter() 공개 정적인 메소드

public static GetWordAfter ( string stringToStartAfter, string entireString, int indexToStartAt, System.StringComparison comparison ) : string
stringToStartAfter string
entireString string
indexToStartAt int
comparison System.StringComparison
리턴 string

HasNumberAtEnd() 공개 정적인 메소드

public static HasNumberAtEnd ( string stringToGetNumberFrom ) : bool
stringToGetNumberFrom string
리턴 bool

IncrementNumberAtEnd() 공개 정적인 메소드

Increments the number at the end of a string or adds a number if none exists.
This method begins looking at the end of a string for numbers and moves towards the beginning of the string until it encounters a character which is not a numerical digit or the beginning of the string. "Sprite123" would return "Sprite124", and "MyString" would return "MyString1".
public static IncrementNumberAtEnd ( string originalString ) : string
originalString string The string to "increment".
리턴 string

InsertSpacesInCamelCaseString() 공개 정적인 메소드

Inserts spaces before every capital letter in a camel-case string. Ignores the first letter.
For example "HelloThereIAmCamelCase" becomes "Hello There I Am Camel Case".
public static InsertSpacesInCamelCaseString ( string originalString ) : string
originalString string The string in which to insert spaces.
리턴 string

IsAscii() 공개 정적인 메소드

public static IsAscii ( string stringToCheck ) : bool
stringToCheck string
리턴 bool

IsNumber() 공개 정적인 메소드

public static IsNumber ( string stringToCheck ) : bool
stringToCheck string
리턴 bool

MakeCamelCase() 공개 정적인 메소드

public static MakeCamelCase ( string originalString ) : string
originalString string
리턴 string

MakeStringUnique() 공개 정적인 메소드

public static MakeStringUnique ( string stringToMakeUnique, List stringList ) : string
stringToMakeUnique string
stringList List
리턴 string

MakeStringUnique() 공개 정적인 메소드

public static MakeStringUnique ( string stringToMakeUnique, List stringList, int numberToStartAt ) : string
stringToMakeUnique string
stringList List
numberToStartAt int
리턴 string

RemoveDuplicates() 공개 정적인 메소드

public static RemoveDuplicates ( List strings ) : void
strings List
리턴 void

RemoveDuplicates() 공개 정적인 메소드

public static RemoveDuplicates ( List strings, bool ignoreCase ) : void
strings List
ignoreCase bool
리턴 void

RemoveNumberAtEnd() 공개 정적인 메소드

Removes the number found at the end of the argument originalString and returns the resulting string, or returns the original string if no number is found.
public static RemoveNumberAtEnd ( string originalString ) : string
originalString string The string that will have the number at its end removed.
리턴 string

RemoveWhitespace() 공개 정적인 메소드

Removes all whitespace found in the argument stringToRemoveWhitespaceFrom.
public static RemoveWhitespace ( string stringToRemoveWhitespaceFrom ) : string
stringToRemoveWhitespaceFrom string The string that will have its whitespace removed.
리턴 string

ReplaceLine() 공개 정적인 메소드

public static ReplaceLine ( string &contents, string contentsOfLineToReplace, string whatToReplaceWith ) : void
contents string
contentsOfLineToReplace string
whatToReplaceWith string
리턴 void