我很难在 sql 上的单词之间留出空格,之前在 sql 上我已经在 vb.net 上做过:
'============================= Create Space Between Words ========================'
'Split The Words into 3 line'
' Lang if 0 english else if 1 Indonesian'
Dim ReceiptTextWords As String() = receiptText.Split("+")
'================================== First Line ==================================='
' This is how the third line appears in the string array after the space splitting'
Dim ReceiptTextWord1 As String() = ReceiptTextWords(0).Split(" ")
' This array contains the spaces reserved for each word in the string array above'
If lang = "0" Then
' MM YY : 0610 REF. NO : 1234567890 R.WAHYUDIYONO,IR '
Dim spaces1 = New Integer() {3, 10, 2, 16, 5, 7, 2, 16, 29}
' Now loop on the strings and format them as indicated by the spaces'
' Attention, the value for space include the string itself'
Dim z As Integer = 0
For Each s In ReceiptTextWord1
sb.Append(s.PadRight(spaces1(z)))
z += 1
Next
ElseIf lang = "1" Then
' BL TH : 0610 NO REF. : 1234567890 R.WAHYUDIYONO,IR '
Dim spaces1 = New Integer() {3, 9, 2, 17, 3, 11, 2, 17, 29}
' Now loop on the strings and format them as indicated by the spaces'
' Attention, the value for space include the string itself'
Dim z As Integer = 0
For Each s In ReceiptTextWord1
sb.Append(s.PadRight(spaces1(z)))
z += 1
Next
End If
但现在我应该在 sql 上做。
在我的存储过程中没有,我手动提供空间并设置 char 变量:
SET @ReceiptText = ' NO REF. : '+@RefNo+' MOHON SIMPAN STRUK INI , SEBAGAI BUKTI PEMBAYARAN YANG SAH '
我觉得这很烦人,有什么解决办法吗?或者我在 vb.net 上所做的可以在 sql 上解决?