Answers for "c#substring example"

C#
30

c sharp substring

// To get a substring of a string use 'Substring()'
// The first value is the index of where to start and the second
// value is the lenght of the substring.
string str = "Hello World!"
str.Substring(3, 4) // Output: "lo W"
  
// If you only give a starting index, it will go until the end
str.Substring(3) // Output: "lo World!"
Posted by: Guest on February-26-2020
2

c substring

//where we want the word "test" and we know its position in the string
char *buff = "this is a test string";
printf("%.*s", 4, buff + 10);
Posted by: Guest on June-21-2020

C# Answers by Framework

Browse Popular Code Answers by Language