Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Strip charcters in middle of string Post Reply Post New Topic
Author Message
TorLang
Groupie
Groupie


Joined: 13 Jun 2012
Location: United States
Online Status: Offline
Posts: 50
Quote TorLang Replybullet Topic: Strip charcters in middle of string
     Posted: 09 Sep 2013 at 6:31am
Here is a quick question:

How do i stip charaters in the middle of a filed, or and position, for that matter? Example: 08/01/2013

I need the 20 stripped to look like 08/01/13

I know I know, but I need to keep it a string.

I've done it before, but just can't recall how I did this.....


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Sep 2013 at 6:45am
you can use a replace
replace(field,"20","")
 
you can convert to a date and back to text
totext(cdate(field),"MM/dd/yy")
 
you can concantenate
left(field,6)&right(field,2)
IP IP Logged
TorLang
Groupie
Groupie


Joined: 13 Jun 2012
Location: United States
Online Status: Offline
Posts: 50
Quote TorLang Replybullet Posted: 09 Sep 2013 at 6:50am
Mr. Blank. I'm gonna have to start sending you free meal tickets. Thanks a bunch.

Using totext(cdate(field),"MM/dd/yy") on the stringvar in question works good. But thanks for giving me "only" 3 options :-)
IP IP Logged
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