mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-08-21 03:54:07 +02:00
Configuration
Core
Bridge
Controls
Handling
Notification
Other
Utils
BrowserCache.cs
BrowserUtils.cs
NativeMethods.cs
StringUtils.cs
TwitterUtils.cs
WindowsUtils.cs
FormBrowser.Designer.cs
FormBrowser.cs
FormBrowser.resx
FormManager.cs
TweetDeckBrowser.cs
Data
Plugins
Properties
Resources
Updates
bld
lib
subprocess
tests
video
.gitattributes
.gitignore
LICENSE.md
Program.cs
README.md
Reporter.cs
TweetDuck.csproj
TweetDuck.sln
TweetDuck.sln.DotSettings
packages.config
* Implement analytics report generation w/ user config and basic system info * Add HW and plugin info to analytics report generation * Add a way of displaying the full analytics report * Fix issues in analytics report and include design theme * Ensure tab config is saved when switching tabs * Fix compilation error in TabSettingsFeedback and safeguard nulls * Add locale to analytics report * Work on analytics (utils, last collection label, dependency refactoring) * Add analytics state file and implement sending reports every week * Send an analytics report after each update
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace TweetDuck.Core.Utils{
|
|
static class StringUtils{
|
|
public static readonly string[] EmptyArray = new string[0];
|
|
|
|
public static string ExtractBefore(string str, char search, int startIndex = 0){
|
|
int index = str.IndexOf(search, startIndex);
|
|
return index == -1 ? str : str.Substring(0, index);
|
|
}
|
|
|
|
public static int[] ParseInts(string str, char separator){
|
|
return str.Split(new char[]{ separator }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
|
|
}
|
|
|
|
public static string ConvertPascalCaseToScreamingSnakeCase(string str){
|
|
return Regex.Replace(str, @"(\p{Ll})(\P{Ll})|(\P{Ll})(\P{Ll}\p{Ll})", "$1$3_$2$4").ToUpper();
|
|
}
|
|
|
|
public static int CountOccurrences(string source, string substring){
|
|
int count = 0, index = 0;
|
|
|
|
while((index = source.IndexOf(substring, index)) != -1){
|
|
index += substring.Length;
|
|
++count;
|
|
}
|
|
|
|
return count;
|
|
}
|
|
}
|
|
}
|