獨立和組有#
和without #
獨立和組有#和無#
Dim Strfinal as String = "#Cccccc,#Aaaaaa,Aaaaa,Baaaa,Caaaa,#Bbbbbb,Abbbbb,Bbbbbb,Cbbbbb"
弦弦我想這樣
#Cccccc, #Aaaaaa(Aaaaa,Baaaa and Caaaa) and #Bbbbbb(Abbbbb,Bbbbbb and Cbbbbb)
輸出我用這個代碼分開沒有的字符#
Dim rws As String
If Aaaaa.Checked = True Then
CheckBox1.Checked = True
close_parenthesis.Checked = True
If rws = "" Then
rws = "(" + Aaaaa.Text
Else
rws = "(" + Aaaaa.Text
End If
End If
If Aaaaa.Checked = False Then
rws = ""
End If
If Baaaa.Checked = True Then
CheckBox1.Checked = True
close_parenthesis.Checked = True
If rws = "" Then
rws = "(" + Baaaa.Text
Else
rws = rws & ", " & Baaaa.Text
End If
End If
If Caaaa.Checked = True Then
CheckBox1.Checked = True
close_parenthesis.Checked = True
If rws = "" Then
rws = "(" + Caaaa.Text
Else
rws = rws & ", " & Caaaa.Text
End If
End If
If close_parenthesis.Checked = True Then
If rws = "" Then
Else
rws = rws + close_parenthesis.Text
End If
End If
CheckBox1.Text = rws.ToString
Me.CagayanReplace.PerformClick()
我使用此代碼爲,
風雲變幻的字and
括號內
Dim Strng As String = Me.CheckBox1.Text
'now find the position of last appearing ","
Dim comaposition As Integer
comaposition = Strng.LastIndexOf(",") 'it is zero based
'if not found, it will return -1 and u can exit, no need to do the work
If comaposition = "-1" Then
Exit Sub
End If
'remove the comma
Dim String_After_Removing_Comma As String
String_After_Removing_Comma = Strng.Remove(comaposition, 1)
'add "and" in the same position where comma was found
Dim final_string As String
final_string = String_After_Removing_Comma.Insert(comaposition, " and ")
'show it on the textbox
CheckBox1.Text = final_string`
請幫我解決這個問題。
這種很爛 - 我希望我能做點什麼。 – EJoshuaS
這是什麼語言?你已經標記了它[vb.net],但代碼不是VB.NET。 – Enigmativity
我使用Vb.net 2017 –