need help!!! math and array


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: need help!!! math and array

  1. #1
    Join Date
    Oct 2006
    Posts
    9

    Unhappy need help!!! math and array

    sory at poor English, but please help me!
    The text like this "r111ak11n1" (chess game).
    how can i make it to "r3ak2n1"?
    PLease Help!

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Code:
    Dim I As Integer
    Dim X As String
    
    X = "r111ak11n1"
    
    For I = 8 To 1 Step -1
        X = Replace(X, String(I, "1"), I)
    Next
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Oct 2006
    Posts
    9
    Thank You Mr Webber!
    Now i know, i have spent over 24 hrs on this one. Dam i should ask here!<<<New to VB.

  4. #4
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    Actually you only need to go from 8 To 2, rather than 8 To 1.
    Since you are trying to change streams of 1's into their numeric count.
    11 ends up as 2; but 1 ends up as 1, so it's a bit of a wasted step.
    For I = 8 To 2 Step -1
    ...

Similar Threads

  1. Replies: 3
    Last Post: 10-31-2006, 04:51 PM
  2. How do I Read a column into an array?
    By davidw in forum Database
    Replies: 0
    Last Post: 04-25-2006, 10:16 PM
  3. Read Columns and Assign Value to Array?
    By davidw in forum VB Classic
    Replies: 0
    Last Post: 04-25-2006, 12:50 AM
  4. array functions
    By kevin hankins in forum authorevents.morrison
    Replies: 1
    Last Post: 11-13-2000, 09:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center