C# strings

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

20 Terms

1
New cards

string

object of the system.string class

2
New cards

string literals

enclosed in double quotes (“ “)

3
New cards

verbatim strings

(@) preserve escape characters and allow multiline strings

4
New cards

length

gets the number of string

<p>gets the number of string</p>
5
New cards

comparing strings

comparing strings using (==)

<p>comparing strings using (==)</p>
6
New cards

indexer

getting the character at an index


uses ([]) to access a character

<p>getting the character at an index</p><p></p><p>uses ([])  to access a character</p>
7
New cards

string.IsNullOrEmpty

Checks whether a specified string is null or an

empty string ("").

<p>Checks whether a specified string is null or an</p><p>empty string ("").</p>
8
New cards

string.IsNullOrWhiteSpace

Checks whether a specified string is null,

empty (""), or consists only of whitespace characters.


//true or false

<p>Checks whether a specified string is null,</p><p>empty (""), or consists only of whitespace characters.</p><p></p><p>//true or false</p>
9
New cards

.ToUpper/Lower()

to change case

<p>to change case </p>
10
New cards

IndexOf

Returns the zero-based index of the first occurrence of a specified character or

substring within the string. If the value is not found, it returns -1.


variablename.Methods

11
New cards

LastIndexOf

Returns the zero-based index of the last occurrence of a specified character

or substring by searching from right to left. If the value is not found, it returns -1.


variablename.Methods

12
New cards

contains

Returns a boolean value (true or false) indicating whether the specified

character or substring occurs anywhere within the string.


variablename.Methods

13
New cards

.ToString

convert variables to string

14
New cards

Substring()

extracts part of a string, starting at a specific index and optionally for a given length.

<p>extracts part of a string,  starting at a specific index and optionally for a given length.</p>
15
New cards

.Trim

Removes all leading (beginning) and trailing (end) occurrences of

whitespace or specified characters from the string.

16
New cards

.TrimStart

Removes all leading (beginning) occurrences of whitespace or

specified characters from the string.

17
New cards

.TrimEnd

Removes all trailing (end) occurrences of whitespace or specified

characters from the string.

18
New cards

Replace()

replaces all occurrences of a specified substring with another substring.

<p>replaces all occurrences of a specified substring with another substring.</p>
19
New cards

Starts/EndsWith()

to check if a string begins or ends with a specific substring.


true or false output

20
New cards

Split

to divide a string into an array of substrings based on a

delimiter.

<p>to divide a string into an array of substrings based on a</p><p>delimiter.</p>