Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. Dim s = "POINT(921021.98 6671778.45)"
  2. Dim b1 = s.IndexOf("("c) + 1
  3. Dim b2 = s.IndexOf(")"c) - 1
  4. Dim parts = s.Substring(b1, b2 - b1 + 1).Split({" "c})
  5. Dim x As Decimal = Decimal.Parse(parts(0))
  6. Dim y As Decimal = Decimal.Parse(parts(1))
  7.  
  8. Dim s = "POINT(921021.98 6671778.45)"
  9.  
  10. Dim x As Decimal
  11. Dim y As Decimal
  12.  
  13. Dim re = New Regex("((?<x>[0-9-.]+) (?<y>[0-9-.]+))")
  14. Dim m = re.Match(s)
  15. If m.Success Then
  16. x = Decimal.Parse(m.Groups("x").Value)
  17. y = Decimal.Parse(m.Groups("y").Value)
  18. Else
  19. ' Could not parse point. Do something about it if required.
  20. End If
  21.  
  22. Dim s = "POINT(921021.98 6671778.45)"
  23.  
  24. Dim part1 As String = s.Remove(0, 6)
  25. Dim part2 As String = part1.Substring(0, part1.Length - 1)
  26. Dim split() As String = part2.Split(" ")
  27.  
  28. Dim x = split(0)
  29. Dim y = split(1)
  30.  
  31. Dim s as String = "POINT(921021.98 6671778.45)"
  32. Dim coordinate() as String = s.Replace("POINT(", "").Replace(")", "").Split(" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement