Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
C# Dictionary with Enum Keys And Values
HawkSearch field naming convention
Found many section of times intersect (can edit)
Tttt
train 11111111
Custom Date Format
Plantera mas com escolhas
Exception handling2
Upgrade
Math Main
Please log in to post a comment.