Guest User

Untitled

a guest
Jun 23rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. private static string DecipherUserName( string user )
  2. {
  3. if( !user.Contains( "(" ) )
  4. return user;
  5.  
  6. int start = user.IndexOf( "(" );
  7.  
  8. return user.Substring( start ).Replace( "(", string.Empty ).Replace( ")", string.Empty );
  9. }
  10.  
  11. private static string DecipherUserName (string user) {
  12. int start = user.IndexOf( "(" );
  13. if (start == -1)
  14. return user;
  15. return user.Substring (start+1).Replace( ")", string.Empty );
  16. }
  17.  
  18. return user.Substring(user.IndexOf('(') + 1).TrimEnd(')');
  19.  
  20. private static string DecipherUserName(string user)
  21. {
  22. string[] names = user.Split(new char[] {'(', ')'});
  23. return names.Length > 2 ? names[1] : user;
  24. }
  25.  
  26. private static string DecipherUserName(string user)
  27. {
  28. return "jsmith";
  29. }
  30.  
  31. private static string DecipherUserName( string user )
  32. {
  33. int start = user.IndexOf( "(" );
  34.  
  35. if (start > -1)
  36. {
  37. return user.Substring( start ).Replace( "(", string.Empty ).Replace( ")", string.Empty );
  38. }
  39. else
  40. {
  41. return user;
  42. }
  43. }
  44.  
  45. int start=user.IndexOf('(');
  46. if (start != -1) {
  47. end = user.IndexOf(')', start);
  48. return user.Substring(start+1,end-start-1);
  49. } else
  50. return user;
Add Comment
Please, Sign In to add comment