Jump to content

How to check values in an array and how to convert array of characters to a string

asim1999

i have two dyanic arraysarray[1.225] of byte and char respectively which retrieve values from input and for loops. How do i convert al the contents from a char array into a string and chech each ascii val in the other array using the if function and how do i convert it to another number if each vlaue is not valid (using lazarus BTW)

Current Rig:   CPU: AMD 1950X @4Ghz. Cooler: Enermax Liqtech TR4 360. Motherboard:Asus Zenith Extreme. RAM: 8GB Crucial DDR4 3666. GPU: Reference GTX 970  SSD: 250GB Samsung 970 EVO.  HDD: Seagate Barracuda 7200.14 2TB. Case: Phanteks Enthoo Pro. PSU: Corsair RM1000X. OS: Windows 10 Pro UEFI mode  (installed on SSD)

Peripherals:  Display: Acer XB272 1080p 240Hz G Sync Keyboard: Corsair K95 RGB Brown Mouse: Logitech G502 RGB Headhet: Roccat XTD 5.1 analogue

Daily Devices:Sony Xperia XZ1 Compact and 128GB iPad Pro

Link to comment
Share on other sites

Link to post
Share on other sites

Triedo it but i can't

Current Rig:   CPU: AMD 1950X @4Ghz. Cooler: Enermax Liqtech TR4 360. Motherboard:Asus Zenith Extreme. RAM: 8GB Crucial DDR4 3666. GPU: Reference GTX 970  SSD: 250GB Samsung 970 EVO.  HDD: Seagate Barracuda 7200.14 2TB. Case: Phanteks Enthoo Pro. PSU: Corsair RM1000X. OS: Windows 10 Pro UEFI mode  (installed on SSD)

Peripherals:  Display: Acer XB272 1080p 240Hz G Sync Keyboard: Corsair K95 RGB Brown Mouse: Logitech G502 RGB Headhet: Roccat XTD 5.1 analogue

Daily Devices:Sony Xperia XZ1 Compact and 128GB iPad Pro

Link to comment
Share on other sites

Link to post
Share on other sites

Lets start with the easier of the two options. Converting a char array to a string can be done by looping through the array and adding each character to the end of the string.
 
A simple way to adding a character to the end of a string is to make a string equal to itself concatenated with the character.
str = str + chr// examplestr = '' // str is currently emptystr = str + 'h' // str now equals hstr = str + 'i' // str now equals hi

With that info you can try to figure the rest out yourself.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×