C# 클래스 GarrysModLuaShared.@string

The string type is a sequence of characters. The string library is a standard Lua library which provides functions for the manipulation of strings. In Garry's Mod there are several extra useful functions added to this library.
파일 보기 프로젝트 열기: OmegaExtern/gmod-csharp-binary-module

공개 메소드들

메소드 설명
@byte ( LuaState luaState, string inputString, uint startPos = 1U, uint endPos = 1U ) : byte[]

Returns the given string's characters in their numeric ASCII representation.

@char ( LuaState luaState ) : string

Takes the given numerical bytes and converts them to a string.

Comma ( LuaState luaState, double inputNumber ) : string

Inserts commas for every third digit.

EndsWith ( LuaState luaState, string inputString, string endString ) : bool

Returns whether or not the second passed string matches the end of the first.

FormattedTime ( LuaState luaState, double @float, string format ) : string

Returns the time as a formatted string or as a table if no format is given.

GetExtensionFromFilename ( LuaState luaState, string fileName ) : string

Returns extension of the file.

GetFileFromFilename ( LuaState luaState, string fileName ) : string

Returns file name and extension.

GetPathFromFilename ( LuaState luaState, string fileName ) : string

Returns the path only from a file's path.

JavascriptSafe ( LuaState luaState, string inputString ) : string

Escapes special characters for JavaScript in a string, making the string safe for inclusion in to JavaScript strings.

Left ( LuaState luaState, string inputString, uint num ) : string

Returns everything left of supplied place of inputString.

NiceSize ( LuaState luaState, uint bytes ) : string

Converts supplied number into bytes.

NiceTime ( LuaState luaState, uint seconds ) : string

Converts supplied number into string.

PatternSafe ( LuaState luaState, string inputString ) : string

Escapes all special characters within a string, making the string safe for inclusion in a Lua pattern.

Replace ( LuaState luaState, string input, string find, string replace ) : string

Replaces all occurrences of the supplied second string.

Right ( LuaState luaState, string inputString, uint num ) : string

Returns the last n-th characters of the string.

SetChar ( LuaState luaState, string inputString, uint index, char replacement ) : string

Sets the character at the specific index of the string.

StartWith ( LuaState luaState, string inputString, string startString ) : bool

Returns whether or not the first string starts with the second.

StripExtension ( LuaState luaState, string fileName ) : string

Removes the extension of a path.

ToMinutesSeconds ( LuaState luaState, uint time ) : string

Returns the given time in "MM:SS" format.

ToMinutesSecondsMilliseconds ( LuaState luaState, double time ) : string

Returns the given time in "MM:SS:MS" format.

Trim ( LuaState luaState, string inputString, string match = " " ) : string

Removes leading and trailing matches of a string.

TrimLeft ( LuaState luaState, string inputString, string match = " " ) : string

Removes leading spaces/characters from a string.

TrimRight ( LuaState luaState, string inputString, string match = " " ) : string

Removes trailing spaces/passed character from a string.

find ( LuaState luaState, string hayStack, string needle, int startPos = 1, bool noPatterns = false ) : int>.Tuple

Attempts to find the specified substring in a string, uses patterns by default.

find ( LuaState luaState, int &start, int &end, string hayStack, string needle, int startPos = 1, bool noPatterns = false ) : void

Attempts to find the specified substring in a string, uses patterns by default.

format ( LuaState luaState, string inputString ) : string

Formats the specified values into the string given.

gsub ( LuaState luaState, string input, string pattern, string replacement, uint maxReplaces = default(uint) ) : uint>.Tuple

This functions main purpose is to replace certain character sequences in a string using patterns.

gsub ( LuaState luaState, string &replaceResult, uint &replaceCount, string input, string pattern, string replacement, uint maxReplaces = default(uint) ) : void

This functions main purpose is to replace certain character sequences in a string using patterns.

len ( LuaState luaState, string inputString ) : uint

Counts the number of characters in the string (length).

lower ( LuaState luaState, string inputString ) : string

Changes any upper-case letters in a inputString to lower-case letters.

match ( LuaState luaState, string inputString, string pattern, int startPosition ) : string

Finds a http://wiki.garrysmod.com/page/Patterns">pattern in a

rep ( LuaState luaState, string inputString, uint repetitions ) : string

Repeats a string by the given value.

reverse ( LuaState luaState, string inputString ) : string

Reverses a string.

sub ( LuaState luaState, string inputString, uint startPos, uint endPos = default(uint) ) : string

Returns a sub-string, starting from the character at position startPos of the string (inclusive), and optionally ending at the character at position endPos of the string (also inclusive). If endPos is not given, the rest of the string is returned.

upper ( LuaState luaState, string inputString ) : string

Changes any lower-case letters in a string to upper-case letters.

메소드 상세

@byte() 공개 정적인 메소드

Returns the given string's characters in their numeric ASCII representation.
public static @byte ( LuaState luaState, string inputString, uint startPos = 1U, uint endPos = 1U ) : byte[]
luaState LuaState Pointer to lua_State struct.
inputString string The string to get the chars from.
startPos uint The first character of the string to get the byte of.
endPos uint The last character of the string to get the byte of.
리턴 byte[]

@char() 공개 정적인 메소드

Takes the given numerical bytes and converts them to a string.
public static @char ( LuaState luaState ) : string
luaState LuaState Pointer to lua_State struct.
리턴 string

Comma() 공개 정적인 메소드

Inserts commas for every third digit.
public static Comma ( LuaState luaState, double inputNumber ) : string
luaState LuaState Pointer to lua_State struct.
inputNumber double The input number to commafy.
리턴 string

EndsWith() 공개 정적인 메소드

Returns whether or not the second passed string matches the end of the first.
public static EndsWith ( LuaState luaState, string inputString, string endString ) : bool
luaState LuaState Pointer to lua_State struct.
inputString string The string whose end is to be checked.
endString string The string to be matched with the end of the first.
리턴 bool

FormattedTime() 공개 정적인 메소드

Returns the time as a formatted string or as a table if no format is given.
public static FormattedTime ( LuaState luaState, double @float, string format ) : string
luaState LuaState Pointer to lua_State struct.
@float double
format string An optional formatting to use. If no format it specified, a table will be returned instead.
리턴 string

GetExtensionFromFilename() 공개 정적인 메소드

Returns extension of the file.
public static GetExtensionFromFilename ( LuaState luaState, string fileName ) : string
luaState LuaState Pointer to lua_State struct.
fileName string String e.g. file-path to get the file extensions from.
리턴 string

GetFileFromFilename() 공개 정적인 메소드

Returns file name and extension.
public static GetFileFromFilename ( LuaState luaState, string fileName ) : string
luaState LuaState Pointer to lua_State struct.
fileName string The string e.g. file-path to get the file-name from.
리턴 string

GetPathFromFilename() 공개 정적인 메소드

Returns the path only from a file's path.
public static GetPathFromFilename ( LuaState luaState, string fileName ) : string
luaState LuaState Pointer to lua_State struct.
fileName string String to get path from.
리턴 string

JavascriptSafe() 공개 정적인 메소드

Escapes special characters for JavaScript in a string, making the string safe for inclusion in to JavaScript strings.
public static JavascriptSafe ( LuaState luaState, string inputString ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string that should be escaped.
리턴 string

Left() 공개 정적인 메소드

Returns everything left of supplied place of inputString.
public static Left ( LuaState luaState, string inputString, uint num ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string to extract from.
num uint Amount of chars relative to the beginning (starting from 1).
리턴 string

NiceSize() 공개 정적인 메소드

Converts supplied number into bytes.
public static NiceSize ( LuaState luaState, uint bytes ) : string
luaState LuaState Pointer to lua_State struct.
bytes uint The number to convert into bytes.
리턴 string

NiceTime() 공개 정적인 메소드

Converts supplied number into string.
public static NiceTime ( LuaState luaState, uint seconds ) : string
luaState LuaState Pointer to lua_State struct.
seconds uint The number to convert into string.
리턴 string

PatternSafe() 공개 정적인 메소드

Escapes all special characters within a string, making the string safe for inclusion in a Lua pattern.
public static PatternSafe ( LuaState luaState, string inputString ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string to be sanitized.
리턴 string

Replace() 공개 정적인 메소드

Replaces all occurrences of the supplied second string.
public static Replace ( LuaState luaState, string input, string find, string replace ) : string
luaState LuaState Pointer to lua_State struct.
input string The string we are seeking to replace an occurrence(s).
find string What we are seeking to replace.
replace string What to replace find with.
리턴 string

Right() 공개 정적인 메소드

Returns the last n-th characters of the string.
public static Right ( LuaState luaState, string inputString, uint num ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string to extract from.
num uint Amount of chars relative to the end (starting from 1).
리턴 string

SetChar() 공개 정적인 메소드

Sets the character at the specific index of the string.
public static SetChar ( LuaState luaState, string inputString, uint index, char replacement ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The input string.
index uint The character index, 1 is the first from left.
replacement char String to replace with.
리턴 string

StartWith() 공개 정적인 메소드

Returns whether or not the first string starts with the second.
public static StartWith ( LuaState luaState, string inputString, string startString ) : bool
luaState LuaState Pointer to lua_State struct.
inputString string String to check.
startString string String to check with.
리턴 bool

StripExtension() 공개 정적인 메소드

Removes the extension of a path.
public static StripExtension ( LuaState luaState, string fileName ) : string
luaState LuaState Pointer to lua_State struct.
fileName string The path to change.
리턴 string

ToMinutesSeconds() 공개 정적인 메소드

Returns the given time in "MM:SS" format.
public static ToMinutesSeconds ( LuaState luaState, uint time ) : string
luaState LuaState Pointer to lua_State struct.
time uint Time in seconds.
리턴 string

ToMinutesSecondsMilliseconds() 공개 정적인 메소드

Returns the given time in "MM:SS:MS" format.
public static ToMinutesSecondsMilliseconds ( LuaState luaState, double time ) : string
luaState LuaState Pointer to lua_State struct.
time double Time in seconds.
리턴 string

Trim() 공개 정적인 메소드

Removes leading and trailing matches of a string.
public static Trim ( LuaState luaState, string inputString, string match = " " ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string to trim.
match string String to match.
리턴 string

TrimLeft() 공개 정적인 메소드

Removes leading spaces/characters from a string.
public static TrimLeft ( LuaState luaState, string inputString, string match = " " ) : string
luaState LuaState Pointer to lua_State struct.
inputString string String to trim.
match string Character to remove.
리턴 string

TrimRight() 공개 정적인 메소드

Removes trailing spaces/passed character from a string.
public static TrimRight ( LuaState luaState, string inputString, string match = " " ) : string
luaState LuaState Pointer to lua_State struct.
inputString string String to remove from.
match string Character to remove.
리턴 string

find() 공개 정적인 메소드

Attempts to find the specified substring in a string, uses patterns by default.
public static find ( LuaState luaState, string hayStack, string needle, int startPos = 1, bool noPatterns = false ) : int>.Tuple
luaState LuaState Pointer to lua_State struct.
hayStack string The string to search in.
needle string The string to find, can contain patterns if enabled.
startPos int /// The position to start the search from, can be negative start position will be relative to the /// end position. ///
noPatterns bool Set to true to disable patterns.
리턴 int>.Tuple

find() 공개 정적인 메소드

Attempts to find the specified substring in a string, uses patterns by default.
public static find ( LuaState luaState, int &start, int &end, string hayStack, string needle, int startPos = 1, bool noPatterns = false ) : void
luaState LuaState Pointer to lua_State struct.
start int Starting position of the found text.
end int Ending position of found text.
hayStack string The string to search in.
needle string The string to find, can contain patterns if enabled.
startPos int /// The position to start the search from, can be negative start position will be relative to the /// end position. ///
noPatterns bool Set to true to disable patterns.
리턴 void

format() 공개 정적인 메소드

Formats the specified values into the string given.
public static format ( LuaState luaState, string inputString ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string to be formatted. /// /// Follows this format. ///
리턴 string

gsub() 공개 정적인 메소드

This functions main purpose is to replace certain character sequences in a string using patterns.
public static gsub ( LuaState luaState, string input, string pattern, string replacement, uint maxReplaces = default(uint) ) : uint>.Tuple
luaState LuaState Pointer to lua_State struct.
input string String which should be modified.
pattern string The pattern that defines what should be matched and eventually be replaced.
replacement string /// In case of a string the matches sequence will be replaced with it. /// /// In case of a table, the matched sequence will be used as key and the table will tested for the key, if a value /// exists it will be used as replacement. /// /// In case of a function all matches will be passed as parameters to the function, the return value(s) of the function /// will then be used as replacement. ///
maxReplaces uint Maximum number of replacements to be made.
리턴 uint>.Tuple

gsub() 공개 정적인 메소드

This functions main purpose is to replace certain character sequences in a string using patterns.
public static gsub ( LuaState luaState, string &replaceResult, uint &replaceCount, string input, string pattern, string replacement, uint maxReplaces = default(uint) ) : void
luaState LuaState Pointer to lua_State struct.
replaceResult string Replaced string.
replaceCount uint Number of replaces.
input string String which should be modified.
pattern string The pattern that defines what should be matched and eventually be replaced.
replacement string /// In case of a string the matches sequence will be replaced with it. /// /// In case of a table, the matched sequence will be used as key and the table will tested for the key, if a value /// exists it will be used as replacement. /// /// In case of a function all matches will be passed as parameters to the function, the return value(s) of the function /// will then be used as replacement. ///
maxReplaces uint Maximum number of replacements to be made.
리턴 void

len() 공개 정적인 메소드

Counts the number of characters in the string (length).
public static len ( LuaState luaState, string inputString ) : uint
luaState LuaState Pointer to lua_State struct.
inputString string The string to find the length of.
리턴 uint

lower() 공개 정적인 메소드

Changes any upper-case letters in a inputString to lower-case letters.
public static lower ( LuaState luaState, string inputString ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string to convert.
리턴 string

match() 공개 정적인 메소드

Finds a http://wiki.garrysmod.com/page/Patterns">pattern in a
public static match ( LuaState luaState, string inputString, string pattern, int startPosition ) : string
luaState LuaState Pointer to lua_State struct.
inputString string String which should be searched in for matches.
pattern string The pattern that defines what should be matched.
startPosition int /// The start index to start the matching from, can be negative to start the match from a /// position relative to the end. ///
리턴 string

rep() 공개 정적인 메소드

Repeats a string by the given value.
public static rep ( LuaState luaState, string inputString, uint repetitions ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string to repeat.
repetitions uint How many times to repeat.
리턴 string

reverse() 공개 정적인 메소드

Reverses a string.
public static reverse ( LuaState luaState, string inputString ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string to be reversed.
리턴 string

sub() 공개 정적인 메소드

Returns a sub-string, starting from the character at position startPos of the string (inclusive), and optionally ending at the character at position endPos of the string (also inclusive). If endPos is not given, the rest of the string is returned.
public static sub ( LuaState luaState, string inputString, uint startPos, uint endPos = default(uint) ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string you'll take a sub-string out of.
startPos uint The position of the first character that will be included in the sub-string.
endPos uint The position of the last character to be included in the sub-string.
리턴 string

upper() 공개 정적인 메소드

Changes any lower-case letters in a string to upper-case letters.
public static upper ( LuaState luaState, string inputString ) : string
luaState LuaState Pointer to lua_State struct.
inputString string The string to convert.
리턴 string