Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

first character of a string c#

string str = "youtube";
char firstCharacter = str[0];
Comment

how to get first char of a string c#

string str = "ararara";
string str1 = str.Substring(0,1); // returns string so [a]
char str2 = str[0]; // This uses the String.Chars indexer, returns 'a'
char str3 = str.First(); // returns first character 'a' same as [0]

Console.WriteLine("str.Substring(0,1) {0}
str[0] {1}
str.FirstOrDefault() {2}", str1,str2,str3);
Comment

PREVIOUS NEXT
Code Example
Csharp :: string methods in c# 
Csharp :: list dictionary c# 
Csharp :: list<string,string c# 
Csharp :: check list exist in list c# if matches any 
Csharp :: c# String Uppercase and Lowercase method 
Csharp :: unity NetworkBehaviour the type or namespace could not be found 
Csharp :: unity destroy 
Csharp :: assetfinder 
Csharp :: run async method parallel c# 
Csharp :: transform face player unity 
Csharp :: unity iap 
Csharp :: unity getcomponent transform.position 
Csharp :: unity ik nothing is happening 
Csharp :: C# a program to reverse each word in the given string. 
Csharp :: como guardar archivo en un botón asp.net 
Html :: html grundgerüst 
Html :: link js to html 
Html :: how to open link in new tab 
Html :: font awesome linkedin 
Html :: html fav icon 
Html :: link email anchor to open up users email address 
Html :: html input type file accept text and word files 
Html :: input hidden 
Html :: html email links 
Html :: html code æøå 
Html :: html entity and 
Html :: html horizontal line style 
Html :: ngclass else 
Html :: buton html href 
Html :: htaccess code to remove .php extension 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =