Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

If I have the following strings

 

Vauxhall Corsa 1.2 XS 5 Door

1.4 Citroen Saxo Red

Ford Escort Si 1.6i

 

I need to pass them to a function and get the engine sizes out. So for these examples

 

1.2

1.4

1.6

 

All the engine sizes will be in the same format number - full stop/period -number.

 

I'm guessing regex might do it but never used before.

 

Thanks

Posted

Regex is a perfect candidate for this.

 

Something like Regex.Match would probably do the trick. The regular expression might look something like [0-9]\.[0-9] which says "any single digit 0-9 followed by a . followed by any single digit 0-9.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...