Ishan
Ishan

Reputation: 4028

Formatting a Text in SSRS

I have a text of the form

1;#aa2;#dde4;#sdfsa6;#hjjs

I want to remove digit and ;# from the above string and keep the string as

aa
dde
sdfsa
hjjs

Is there a way like we do in C# to check if string contains <digit>;# and replace it with a
or a blank space.

I was trying to split on ;# as

=(Split(Fields!ows_Room.Value,";#")).GetValue(1)

but than the output is only aa2.

Upvotes: 1

Views: 650

Answers (2)

Aftab Ansari
Aftab Ansari

Reputation: 946

Give a try to following expression.

    =Join(Split((System.Text.RegularExpressions.Regex.Replace(Fields!ows_Room.Value, "[0-9]", "").Trim(";").Trim("#")),";#"),” “)

Upvotes: 0

Aftab Ansari
Aftab Ansari

Reputation: 946

You are getting aa2 only because GetValue(1) retruns the first indexed array value. Change you expression to

    = Join(Split(Fields!ows_Room.Value,";#"),” “)

If you want the output like

aa2
dde4
sdfsa6
hjjs

use this expression

    = Join(Split(Fields!ows_Room.Value,";#"),VBCRLF)

Upvotes: 1

Related Questions