Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
string test
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here /* string email = "Bla bla hello my friend THIS IS THE STUFF I WANTGoodbye my friend"; int startPos = email.LastIndexOf("hello my friend") + "hello my friend".Length + 1; int length = email.IndexOf("Goodbye my friend") - startPos; string sub = email.Substring(startPos, length); //Console.WriteLine(email.LastIndexOf("hello my friend"));*/ string math = "11 456/789"; if (math.IndexOf(" ")!=-1) { int lengthInt = math.IndexOf(" "); int startPos = math.IndexOf(" ")+1; int lengthNum = math.IndexOf("/")-math.IndexOf(" ")-1; Console.WriteLine(math.Substring(0,lengthInt)); // integer Console.WriteLine(math.Substring(startPos,lengthNum)); // numerator Console.WriteLine(math.Substring(math.IndexOf("/")+1)); // denominator } else { Console.WriteLine(math.Substring(0,math.IndexOf("/"))); // numerator Console.WriteLine(math.Substring(math.IndexOf("/")+1)); // denominator } } } }
run
|
edit
|
history
|
help
0
Main4-5
a
Enigme
sadfghjklö
train555555
A2Z Dice Roll
Generics Operator test
GetDataFromSQLGroups
Next Letter
sdfghjtrefdc v