Displaying an Array

  1. 5 days ago

    Hi,

    I am currently just playing around trying to be more fluent in xojo and I've come across a question. How do you display an array's contents into a text area, or text field?
    Dim quote As string = quoteArea.text Dim whaleText As text Dim whaleResult() as text whaleResult = varType(translateQuote(quote)) whaleText = text.Join(whaleResult, " ") whaleArea.text = whaleText
    translateQuote is a function that would append an array(this array contains the new text in whale language) . I am trying to display the new array of 'whale' letters to a text area but can't. Any ideas?

    You probably shouldn't mix text and string. I've made your code a bit shorter:

    dim quote as String = quoteArea.text
    dim whaleResult(-1) as string = translateQuote(quote)
    WhaleArea.text = join(WhaleResult, " ")

    Now you need to check with the debugger what's in whaleResult.

  2. Beatrix W

    May 14 Pre-Release Testers Answer Europe (Germany)

    You probably shouldn't mix text and string. I've made your code a bit shorter:

    dim quote as String = quoteArea.text
    dim whaleResult(-1) as string = translateQuote(quote)
    WhaleArea.text = join(WhaleResult, " ")

    Now you need to check with the debugger what's in whaleResult.

  3. 4 days ago

    This is the code inside the translateQuote function

    Redim whaley(-1)
    vowels() = Array("a", "e", "i", "o", "u")
    Dim i As integer
    
    quoteArray =  quote.Split("")
    
    For i=0 To quoteArray.Ubound
      For i=0 To vowels.Ubound
        if quoteArray(i) = vowels(i) then
          if quoteArray(i) = "e" then
            whaley.Append("ee")
          elseif quoteArray(i) = "u" then
            whaley.Append("uu")
          else
            whaley.Append(vowels(i))
          end if
        end if
      next
      return whaley
    next

    I'm having trouble debugging because I'm still quite new to coding. Please help me

  4. Ivan T

    May 15 Pre-Release Testers

    @FirasKamarulzaman I'm having trouble debugging because I'm still quite new to coding. Please help me

    The function makes no sense at all. The counter in the nested for cant be the same as the first one. The first for is allways going to exit after the first iteration. Not really clear whay you intend, but it lloks like you should have a SELECT instead of the second for. ETC.

    It does not make sense to ask for a solution if you do not understand the basic concepts of coding. It is better to learn the basics of language and then ask more specific questions.

    https://docs.xojo.com/GettingStarted:Welcome

    https://www.xojo.com/resources/learn.php

    https://docs.xojo.com/index.php/

  5. Thanks for the tip @Ivan T and @Beatrix W . I accidently mixed up some javascript concepts with Xojo's. I appreciate the advice. How may I practise the basics to be more fluent in Xojo?

  6. Beatrix W

    May 15 Pre-Release Testers Europe (Germany)

    You practise the same as for everything else. You try, you embarrass yourself, you try again :-)

  7. Ivan T

    May 16 Pre-Release Testers

    @FirasKamarulzaman Thanks for the tip @Ivan T and @Beatrix W . I accidently mixed up some javascript concepts with Xojo's. I appreciate the advice. How may I practise the basics to be more fluent in Xojo?

    Start with the resources I recomended, after that you can open and play with the examples included in Xojo.

or Sign Up to reply!