Re: count_string program

From: Björn Persson (spam-away_at_nowhere.nil)
Date: 02/27/04

  • Next message: Alexandre E. Kopilovitch: "Re: left-to-right (was In-Out Parameters for functions)"
    Date: Fri, 27 Feb 2004 18:29:38 GMT
    
    

    tmoran@acm.org wrote:

    > In the real world, you can probably assume most
    > users won't enter more than, say, 1,000 characters, so you could specify
    > that your program only handles a maximum of 1,000, and then declare
    >
    > Input : String(1 .. 1000);

    You (Cecilia) could do that, but if you need to store the string it's
    because you want to use it later. Then you will most likely need to know
    how many of those 1000 positions are used and how many contain garbage.
    That is, you have to keep track of the actual length of the string
    separately. Since there are string types in the standard library that
    keep track of the length automatically, it's better to use them.

    -- 
    Björn Persson
    jor ers @sv ge.
    b n_p son eri nu
    

  • Next message: Alexandre E. Kopilovitch: "Re: left-to-right (was In-Out Parameters for functions)"

    Relevant Pages

    • Re: How to convert Infix notation to postfix notation
      ... If this is for an error message, why isn't it using stderr for its output? ... array of 15 characters, and you call this function with the limit 15 on ... Making sure that the only string I allocate and append to, ... because mulFactor in all versions must needs incorporate the functions ...
      (comp.lang.c)
    • Re: Prothon should not borrow Python strings!
      ... """It does not make sense to have a string without knowing what encoding ... same cul de sac as Python. ... Prothon_String_As_ASCII // raises error if there are high characters ... Python's split between byte strings and Unicode strings is ...
      (comp.lang.python)
    • RE: How do I set up a keystroke macro?
      ... SendKeys Statement ... SendKeys string[, wait] ... Each key is represented by one or more characters. ... To specify one of these characters, ...
      (microsoft.public.access.macros)
    • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
      ... put them in stupid places. ... Programming is difficult (as you must surely appreciate, ... > strings will be in the range 1...1000 characters. ... impose an artificially small limit on string length." ...
      (comp.programming)
    • Re: Byte Array to String
      ... retrieved text will mismatch the original characters. ... encoding the characters. ... Dim strFileData as String ...
      (microsoft.public.dotnet.framework.aspnet)