Apex
»
პროგრამირება
»
C#
»
სტრიქონული ფუნქციები
Rank: Newbie
Medals: Groups: Registered
Joined: 3/22/2010 Posts: 8 Points: 27 Location: Tbilisi
Thanks: 0 times Was thanked: 0 time(s) in 0 post(s)
|
სტრიქონის MD5 ჰეშირება BB კოდი: public static string MD5(string strToEncrypt) { System.Text.UTF8Encoding ue = new System.Text.UTF8Encoding(); byte[] bytes = ue.GetBytes(strToEncrypt);
System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] hashBytes = md5.ComputeHash(bytes);
string hashString = "";
for (int i = 0; i < hashBytes.Length; i++) { hashString += Convert.ToString(hashBytes[i], 16).PadLeft(2, '0'); }
return hashString.PadLeft(32, '0'); }
სტრიქონის გაყოფა მეორე სტრიქონით BB კოდი: public static string[] SplitByString(string testString, string split) { int offset = 0; int index = 0; int[] offsets = new int[testString.Length + 1];
while (index < testString.Length) { int indexOf = testString.IndexOf(split, index); if (indexOf != -1) { offsets[offset++] = indexOf; index = (indexOf + split.Length); } else { index = testString.Length; } }
string[] final = new string[offset + 1]; if (offset == 0) { final[0] = testString; } else { offset--; final[0] = testString.Substring(0, offsets[0]); for (int i = 0; i < offset; i++) { final[i + 1] = testString.Substring(offsets[i] + split.Length, offsets[i + 1] - offsets[i] - split.Length); } final[offset + 1] = testString.Substring(offsets[offset] + split.Length); } return final; }
keep an eye open
|
|
|
|
|
Apex ltd. http://www.apex.ge
|
|
Apex
»
პროგრამირება
»
C#
»
სტრიქონული ფუნქციები
Forum Jump
თქვენ არ შეგიძლიათ დაწეროთ ახალი თემა ამ ფორუმში.
თქვენ არ შეგიძლიათ გასცეთ პასუხი, თემას, ამ ფორუმში .
თქვენ არ შეგიძლიათ წაშალოთ თქვენი პოსტი ამ ფორუმში.
თქვენ არ შეგიძლიათ ჩაასწოროთ თქვენი პოსტი ამ ფორუმში.
თქვენ არ შეგიძლიათ შექმნათ გამოკითხვა ამ ფორუმში.
თქვენ არ შეგიძლიათ ხმის მიცემა ამ ფოუმში.
YAFVision Theme by Jaben Cargman (Tiny Gecko)Powered by YAF |
YAF © 2003-2009, Yet Another Forum.NETThis page was generated in 1.842 seconds.