amisin
Junior Member level 1
- Joined
- Oct 5, 2011
- Messages
- 16
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Location
- Meerut, Uttar Pradesh, India
- Activity points
- 1,431
I have to access each element of a string via a character. So for that I will be using a for loop, but how do we access a specific element of a string. like for string str(1 to 8), if I wish to assign, str(4) to the character variable chr, how exactly we do that?
Here TestValueCharater is of character type, and TestValueReal is of real type. And O_LogisticCode is a string.
Code:
for loopcounter in 0 to 63 loop -- one end loop pending at end.
TestValueCharacter := O_LogisticCode(loopcounter + 1);
if(TestValueCharacter = '0') then
TestValueReal := 0;
elsif(TestValueCharacter = '1') then
TestValueReal := 1;
elsif(TestValueCharacter = '2') then
TestValueReal := 2;
elsif(TestValueCharacter = '3') then
TestValueReal := 3;
end if;
Here TestValueCharater is of character type, and TestValueReal is of real type. And O_LogisticCode is a string.