This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int CountChar(string src, char x) | |
{ | |
int count = 0; | |
for (int i = 0; i < src.Length; i++) | |
{ | |
//.ToString().ToUpper(): CaSe sensitive or not | |
if (x.ToString().ToUpper() == src[i].ToString().ToUpper()) count++; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string CapitalizedString(string input) | |
{ | |
string[] arr = input.Split(' '); | |
string result = string.Empty; | |
foreach (string a in arr) | |
{ | |
result += a.First().ToString().ToUpper() + a.Substring(1) + " "; | |
} | |
return result.Trim(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string str = "Hello World1"; | |
str = str.Remove(str.Length - 1); | |
//str is now "Hello World" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string[] arr = ... | |
List<string> list = new List<string>(arr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<string> names = new List<string>() { "John", "Anna", "Monica" }; | |
var result = String.Join(", ", names.ToArray()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<T> noDupes = noDupes.Distinct().ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string ReplaceEx(string original, string pattern, string replacement) | |
{ | |
int count, position0, position1; | |
count = position0 = position1 = 0; | |
string upperString = original.ToUpper(); | |
string upperPattern = pattern.ToUpper(); | |
int inc = (original.Length / pattern.Length) * | |
(replacement.Length - pattern.Length); | |
char[] chars = new char[original.Length + Math.Max(0, inc)]; | |
while ((position1 = upperString.IndexOf(upperPattern, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//First you need to retrieve html source of the given url | |
//Get Url Title | |
private string UrlTitle(string url) | |
{ | |
string source = HtmlSrc(url); | |
string title = Regex.Match(source, @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value; | |
return title; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class CameraController : MonoBehaviour | |
{ | |
public float moveSpeed, zoomSpeed; | |
private Rigidbody rb; | |
void Start () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetAllRegexMatchFromText(string regex, string text) | |
{ | |
Regex linkParser = new Regex(regex, RegexOptions.Compiled | RegexOptions.IgnoreCase); | |
string result = string.Empty; | |
foreach (Match m in linkParser.Matches(text)) | |
result += m.ToString() + "|"; | |
result = result.Remove(result.Length - 1, 1); |