[chronojump] new util.cs methods: ListIntToSQLString SQLStringToListInt
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] new util.cs methods: ListIntToSQLString SQLStringToListInt
- Date: Tue, 1 Feb 2022 16:08:40 +0000 (UTC)
commit 871ae761b1857900d5740979373bb46f7895686a
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Feb 1 15:59:27 2022 +0100
new util.cs methods: ListIntToSQLString SQLStringToListInt
src/util.cs | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/util.cs b/src/util.cs
index 857622b70..a525bee99 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2021 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2022 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -119,6 +119,27 @@ public class Util
return ConvertToPoint(s);
}
+ public static string ListIntToSQLString (List<int> ints, string sep)
+ {
+ string str = "";
+ string sepStr = "";
+ foreach(int i in ints)
+ {
+ str += sepStr + i.ToString();
+ sepStr = sep;
+ }
+ return str;
+ }
+ public static List<int> SQLStringToListInt (string sqlString, string sep)
+ {
+ List<int> l = new List<int>();
+ string [] strFull = sqlString.Split(sep);
+ foreach(string str in strFull)
+ if(IsNumber(str, false))
+ l.Add(Convert.ToInt32(str));
+
+ return l;
+ }
//when we do a query to the server, it returns avg as "0,54" because it's latin localized
//if client is on english machine, need to convert this to "0.54"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]