如何用逗号分隔字符串拆分$ dollar金额

时间:2018-03-09 11:27:14

标签: vb.net

我有下面的字符串,我在vb.net中使用逗号分割函数尝试下面的输出。 但没有运气。

输入:

"Änanth,$10,250,$10,000,$1200"

输出:

  1. Ananth
  2. $ 10,250
  3. $ 10,000
  4. $ 1200
  5. 如何构建上述输出?

3 个答案:

答案 0 :(得分:3)

我认为你的输入是一个字符串,所以你可以使用String.Split方法描述here

这可能对您有用:

Module Example
Public Sub Main()
  Dim value As String = "This is a short string."
  Dim delimiter As Char = "s"c
  Dim substrings() As String = value.Split(delimiter)
  For Each substring In substrings
     Console.WriteLine(substring)
  Next
End Sub
End Module

' The example displays the following output:
'     Thi
'      i
'      a
'     hort
'     tring.

答案 1 :(得分:0)

正如您所说,您不能仅使用逗号作为分隔符,但如果您使用独立的 var site = document.getSiteShortName(); var docLibContainer = siteService.getSite(site).getContainer("documentLibrary"); if(docLibContainer){ // create a new folder in the same space var folderNode = docLibContainer.createFolder(document.properties["ia:whatEvent"]); // copy the doc into the newly created folder node //var copy = document.copy(folderNode); // move the folder node to companyhome var objDestFolder = companyhome.childByNamePath("Shared/SECRETARY/COMMISSION_PAPER_RECEIVED"); folderNode.move(objDestFolder); }else{ // create a new folder in the same space var folderNode = space.createFolder(document.properties["ia:whatEvent"]); // copy the doc into the newly created folder node //var copy = document.copy(folderNode); // move the folder node to companyhome var objDestFolder = companyhome.childByNamePath("Shared/SECRETARY/COMMISSION_PAPER_RECEIVED"); folderNode.move(objDestFolder); } 函数,而不是内置于字符串对象中的Split函数,则可以使用多个字符作为分隔符。如下。我假设你正在编写一个控制台应用程序,所以这应该可行

Split

答案 2 :(得分:0)

它的确定......但是我的字符串格式低于格式,我想要上面的输出

1,1,PATRONAGE DISTRIBUTIONS,A00001PATR01,N / A,N / A,ZZ 1000001,1000001,7,N / A,7,S63," $ 6,411.88"," $ 6,411.88 ",$ 0.00,客户1,82327 330TH ST ,, ELLENDALE,MN,560264012,是,是,1000001,2 / 15/2018,批次​​1,PAT 01,1.82E + 11,75911603,&#34 ; $ 24,761.32",$ 0.00," $ 24,761.32",100%,N / A," $ 3,845.08",$ 648.22," $ 3,845.08",100% ,N / A," $ 3,062.66",$ 0.00,$ 0.00,0%,N / A," $ 4,069.99",$ 0.00,$ 0.00,0%,N / A,&#34 ; $ 4,718.86",$ 0.00,$ 0.00,0%,N / A," $ 6,259.78",$ 0.00,$ 0.00,0%,N / A," $ 5,933.43",$ 0.00 ,$ 0.00,0%,N / A," $ 12,178.72",$ 0.00,$ 0.00,0%,N / A," $ 13,980.26",$ 0.00,$ 0.00,0%,N / A," $ 5,763.66"," $ 5,763.66"," $ 5,763.66",100%,N / A,N / A,N / A,N / A ,N / A,2018年夏天,#34; $ 84,573.76",#34; $ 6,411.88"," $ 34,370.06",41%,N / A," $ 34,370.06"