Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
My C# (2)
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //modifying strings string testString = "Hello, my name is Fredy"; //Replace can be used to replace words with others string resultString = testString.Replace("Fredy", "Hector"); Console.WriteLine(resultString); Console.WriteLine(testString); //Replace can be used in a different way string resString2 = testString.Replace("e", "i"); Console.WriteLine(resString2); //Remove string removeString = testString.Remove(17, 6); Console.WriteLine(removeString); //appending strings testString = testString + " and I am a CS major"; Console.WriteLine(testString); StringBuilder mySB = new StringBuilder("Hello World", 20); Console.WriteLine(mySB); Console.WriteLine("mySB capacity is " + mySB.Capacity); //Methods //Append adds to the end of a stringBuilder mySB.Append(" is our first Program!"); Console.WriteLine(mySB); Console.WriteLine("mySB capacity is " + mySB.Capacity); //Insert adds a string to a certain location using indexes mySB.Insert(24, " small"); Console.WriteLine(mySB); //Remove removes a list of characters starting at certain location mySB.Remove(24, 6); Console.WriteLine(mySB); //Replace mySB.Replace("our", "my"); Console.WriteLine(mySB); mySB.Replace("o", "z"); Console.WriteLine(mySB); mySB.Replace("i", "NOT"); Console.WriteLine(mySB); } } }
run
|
edit
|
history
|
help
0
asxsdxasd sd
11
SafeSquareRoot.java
Plt-D v.0.9.2
NationalCode
My quad calc
RegEx
Download a UTF-8 text file, and display the contents.
2.1 Basic types: Lists and Linq beauty
convert a string of numbers to a list then use a forEach to loop through the list