Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Please help convert this code to VB.NET code...

Please help convert this code to VB.NET code...

Scheduled Pinned Locked Moved Visual Basic
csharpregexhelptutorial
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Support123
    wrote on last edited by
    #1

    Hi, I beleive this sample code is in C#: string cleanString = String.Empty; Regex reg = new Regex("[A-Z]|[a-z]"); MatchCollection coll = reg.Matches(); for(int i = 0; i < coll.Count; i++) { cleanString = cleanString + coll[i].Value; } See, i want to remove all characters that do not fall in the A-Z or a-z OR 0-9 category AND replace it with a space... example test123t3er = test t er Am i wrong in saying that the Regex reg = Regex("[A-Z]|[a-z]") CAN IT BE: Regex reg = Regex("[A-Z]|[a-z]|[0-9]") ??? AND the cleanString = cleanString + coll[i].Value; CAN I DO A TEST: IF(coll[i].Value == String.Empty) THEN cleanString = cleanString + " " ELSE cleanString = cleanString + coll[i].Value ???? - in this way i add space if the character is not in the above category???? So please help me convert the very top section of code and i will build from there... Thank you in advance...

    "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

    D 1 Reply Last reply
    0
    • S Support123

      Hi, I beleive this sample code is in C#: string cleanString = String.Empty; Regex reg = new Regex("[A-Z]|[a-z]"); MatchCollection coll = reg.Matches(); for(int i = 0; i < coll.Count; i++) { cleanString = cleanString + coll[i].Value; } See, i want to remove all characters that do not fall in the A-Z or a-z OR 0-9 category AND replace it with a space... example test123t3er = test t er Am i wrong in saying that the Regex reg = Regex("[A-Z]|[a-z]") CAN IT BE: Regex reg = Regex("[A-Z]|[a-z]|[0-9]") ??? AND the cleanString = cleanString + coll[i].Value; CAN I DO A TEST: IF(coll[i].Value == String.Empty) THEN cleanString = cleanString + " " ELSE cleanString = cleanString + coll[i].Value ???? - in this way i add space if the character is not in the above category???? So please help me convert the very top section of code and i will build from there... Thank you in advance...

      "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

      D Offline
      D Offline
      Dave Doknjas
      wrote on last edited by
      #2

      (via Instant VB): Dim cleanString As String = String.Empty Dim reg As New Regex("[A-Z]|[a-z]") Dim coll As MatchCollection = reg.Matches() For i As Integer = 0 To coll.Count - 1 cleanString = cleanString & coll(i).Value Next i David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI Java to VB & C# Converter: convert Java to VB or C#

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups