Skip to content

Commit 85083f8

Browse files
committed
Updated text representation to be culture-invariant - #6
1 parent 90b68fd commit 85083f8

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎src/Pgvector/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.3 (unreleased)
2+
3+
- Updated text representation to be culture-invariant
4+
15
## 0.1.2 (2023-04-25)
26

37
- Added support for .NET 6 and .NET Standard 2.0

‎src/Pgvector/Vector.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using System.Globalization;
3+
using System.Linq;
24

35
namespace Pgvector
46
{
@@ -13,12 +15,12 @@ public Vector(float[] v)
1315

1416
public Vector(string s)
1517
{
16-
vec = Array.ConvertAll(s.Substring(1, s.Length - 2).Split(','), v => float.Parse(v));
18+
vec = Array.ConvertAll(s.Substring(1, s.Length - 2).Split(','), v => float.Parse(v, CultureInfo.InvariantCulture));
1719
}
1820

1921
public override string ToString()
2022
{
21-
return string.Concat("[", string.Join(",", vec), "]");
23+
return string.Concat("[", string.Join(",", vec.Select(v => v.ToString(CultureInfo.InvariantCulture))), "]");
2224
}
2325

2426
public float[] ToArray()

0 commit comments

Comments
 (0)