Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert IPv4 dotted quad into four decimal values
#2
Ah, I figured out one way to do this. Break up the string variable into its separate characters, as I have already done, then use

digit(j) = Val(char$(i))

to build up the decimal value of each byte of the address. I don't even need to change every dot to a comma. I loop through each address byte until I reach a dot delimiter, and build up the decimal value of that byte. Then move on from there to the next dot delimiter, build up that decimal value. There might be a more clever way, but at least I got this way to work perfectly. Not that much code, once I'm done cleaning it up. Also have to build in checks, to make sure not to exceed valid values.
Reply


Messages In This Thread
RE: Convert IPv4 dotted quad into four decimal values - by bert22306 - 09-02-2022, 02:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Arbitrary CONST values Unseen Machine 31 2,864 10-29-2025, 05:44 AM
Last Post: bplus
  QB64PE programming challenge? auto-convert image to photoreal etch-a-sketch drawing madscijr 9 1,835 02-14-2025, 05:49 PM
Last Post: madscijr
  suggestion: initialize array values within the DIM statement bobalooie 19 3,315 12-22-2022, 06:46 PM
Last Post: Kernelpanic
  String math: Whole # powers easy, decimal powers!!! Pete 0 500 09-12-2022, 08:58 PM
Last Post: Pete

Forum Jump:


Users browsing this thread: 1 Guest(s)