What is wrong with my code

var nums as string
for x as integer = 100 to me.text.length
  //if  the nth character is a number, add it to the string  nums
  
next

if nums > "" then oldFeild.text = nums

I don’t know how to code java

also ran out of replies

email me at noahr48@educbe.ca

@Jeff_Tullin

Please don’t just keep posting things to multiple topics. You’ve already started with this elsewhere. People are not online 24/7, be patient and wait for a reply.

If you’re pasting code, highlight it and press the </> button to format it.

2 Likes

In the original code:

var nums as string
for x as integer = 1 to me.text.length
   //if  the nth character is a number, add it to the string  nums
next

if nums > "" then oldfield.text = nums

the author is trying to tell you that between for and next you need to add code that checks the characters of your text field to get what you want (numbers from a textfield with text and numbers.

As every time the for next loop runs, the code that you need to add there will check if there is a number on that character position and add it to the String called “nums”.

When the for next finally finishes, then you will have a String “nums” with some information (or not), depending on the code that you want and need to replace this comment:

   //if  the nth character is a number, add it to the string  nums

Looking at the other topic, it seems that you didn’t know or understand that you needed to add code here. Even a post you did a copy/paste and you didn’t notice that your textfield was called Oldfeild and Jeff’s code it was called oldfield. Try to use the autocomplete to make sure that you are using the properties/fields names correctly.


Can you post the error/warning that the forum is giving you when you try to reply? This is the first time that I read someone saying they ran out of replies.


Finally:

This is not Java.

This is not java :expressionless:

Looks like you need to start and complete the GETTING STARTED section of the dicumentation. Introduction — Xojo documentation

People can help with snippets or general directions, but dont expect someone to code the app for you or give you a full course on how to code.