Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Replacing Character in String Once Post Reply Post New Topic
Author Message
jsh8286
Groupie
Groupie
Avatar

Joined: 09 Mar 2012
Online Status: Offline
Posts: 46
Quote jsh8286 Replybullet Topic: Replacing Character in String Once
    Posted: 28 Jul 2021 at 7:03am
I want to remove a dash ('-') in a string but only one occurrence of it.

For example have a string of:

"MW-48-00-5182"

But I only want to remove the first occurrence of the dash. In all my records I want to remove the dash in position 3 and leave all other dashes alone if there is any. So the end result for the above example would be:

"MW48-00-5182"

Thanks in advance.

Edited by jsh8286 - 28 Jul 2021 at 7:06am
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 28 Jul 2021 at 7:22am
The "Replace" function can do this work:

Replace("MW-48-00-5182", "-", "", 1, 1)
IP IP Logged
jsh8286
Groupie
Groupie
Avatar

Joined: 09 Mar 2012
Online Status: Offline
Posts: 46
Quote jsh8286 Replybullet Posted: 28 Jul 2021 at 8:24am
Thanks Valert16 worked like a charm!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.