0

OK, so here is what i mean since i couldnt think of a better title, I have 2 editbox's. 1 is for input of a string and the other is for the output.

ive been experimenting with edit2.text := LowerCase (edit1.text); & edit2.text := ReverseString (edit1.text);

i want to use the functions LowerCase & ReverseString at the same time so it both converts the capitals string to lowercase and reverses it also.. i just cant figure out how to do this without throwing all kinds of compiler errors, can anyone help me out

4
  • 1
    Both at the same time? So you want multithread? sure? Commented May 31, 2013 at 23:38
  • 1
    Forget & as anything except a way to provide a shortcut to a button or menu item in the Caption in Delphi. There's only one way to use it as an operator, and chances of you needing that one way are small. The equivalent of VB's & operator in Delphi is and for binary and logical comparisons and + for string concatenation (Result := 'abc' + def';`. Commented Jun 1, 2013 at 0:36
  • I hold my down-vote because it's such a common thing to do in any programming language. Not understanding why anyone would have up-voted this. I haven't written a single project yet that didn't do this. Commented Jun 1, 2013 at 17:18
  • @JerryDodge - I believe this question would be beneficial to anyone searching for this that doesn't know as they would end up here. He didn't know and that is why he asked! I am upvoting just to cancel out your down vote. Commented Jun 1, 2013 at 19:54

2 Answers 2

10

You should do

Edit2.Text := ReverseString(LowerCase(Edit1.Text));

Alternatively, since these functions commute, you can do

Edit2.Text := LowerCase(ReverseString(Edit1.Text));
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you.. that is exactly what i needed! Yes, what do you call it when you do that? when you use ( ( )) ??
@Sheep: Function composition (but it's so 'obvious' you never talk about it, really). If f and g are functions that take a string and return a string, then f('test') is a string [because f returns a string], just as 'test' is! Hence, just as you can compute g('test'), you can compute g(f('test')).
4

How about edit2.text := LowerCase(ReverseString(edit1.text)) ?

1 Comment

Yes, what do you call it when you do that? when you use ( ( )) ??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.