在.rdlc报告中的字符串中添加空格 [英] Adding space in a string in .rdlc report
本文介绍了在.rdlc报告中的字符串中添加空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在VB.Net中使用.rdlc报告
我从数据库中获取了7个字符的varchar值.字符就像"5647912".现在,在报告中,我想向他们显示这样的"564 7912".我该怎么做?
当前我正在使用"= First(Fields!CardNo.Value)"如何获得所需的结果?
谢谢
I am using .rdlc reports in VB.Net
I am getting a 7 chars varchar value from database. The characters are like "5647912". Now in the report I want to show them like this "564 7912". How do I do this??
Currently I am using "=First(Fields!CardNo.Value)" How can I achieve my desired result??
Thanks
推荐答案
尝试此
try this
For i As Integer = 0 To str.Length - 1
If i = 3 Then
str = str.Insert(i, " ")
End If
Next
如果字符串包含数字,我认为最简单的方法是首先将其强制转换为例如整数( ^ ])
然后使用数字格式模型 http://msdn.microsoft.com对其进行格式化/en-us/library/ms157406(v=SQL.100).aspx [
If the string contains numbers, I think the easiest way is to cast it first to for example integer (http://msdn.microsoft.com/en-us/library/ms141704.aspx[^])
And then format it using number format models http://msdn.microsoft.com/en-us/library/ms157406(v=SQL.100).aspx[^]
这篇关于在.rdlc报告中的字符串中添加空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文