Files
rookie/Utilities/StringUtilities.cs
SytheZN d3a2c4012c Release/RSL-2.17 (#128)
* fix: pull to desktop not resetting work status.

resolves #104

* Create Text File with upload size for verification

* bump version

* better public config handling

* code cleanup

Co-authored-by: Fenopy <Fenopie@Gmail.com>
2022-12-05 23:42:59 +02:00

66 lines
1.6 KiB
C#

using System.Linq;
namespace AndroidSideloader.Utilities
{
internal class StringUtilities
{
public static string RemoveEverythingAfterFirst(string s, string removeMe)
{
int index = s.IndexOf(removeMe);
if (index > 0)
{
s = s.Substring(0, index);
}
return s;
}
public static string RemoveEverythingAfterLast(string s, string removeMe)
{
int index = s.LastIndexOf(removeMe);
if (index > 0)
{
s = s.Substring(0, index);
}
return s;
}
public static string RemoveEverythingBeforeFirst(string s, string removeMe)
{
int index = s.IndexOf(removeMe);
if (index > 0)
{
s = s.Substring(index);
}
return s;
}
public static string KeepOnlyNumbers(string s)
{
string numbers = "0123456789";
string a = "";
foreach (char ch in s)
{
if (numbers.Contains(ch))
{
a += ch;
}
}
return a;
}
public static string RemoveEverythingBeforeLast(string s, string removeMe)
{
int index = s.LastIndexOf(removeMe);
if (index > 0)
{
s = s.Substring(index);
}
return s;
}
}
}