String Byte Length: Difference between revisions

From Rosetta Code
Content added Content deleted
mNo edit summary
Line 1: Line 1:
{{Template:split-review}}
[http://nairoz.somee.com/img/styles/al-limite/ al limite] [http://luallard.t35.com/html/stampante-a/ stampante a4 a3 fotografica] [http://ouquaite.freeweb7.com/img/styles/siti-porno/ siti porno maschili] [http://nationavce.somee.com/library/html/deh-/ deh - p7700mp] [http://brrezab.freeweb7.com/img/styles/volvo.htm volvo 50] [http://fergus-mac.somee.com/description/lib/pune-banul/ pune banul jos] [http://lamcgie.125mb.com/html/strage-di.htm strage di capaci] [http://fergus-mac.somee.com/description/lib/multisplit-pompa/ multisplit pompa di calore] [http://rimarsh.t35.com/images/small/automobili-senza.htm automobili senza patente] [http://madavid.t35.com/html/mercati-fiere/ mercati fiere vicenza] [http://luallard.t35.com/html/triciclo-metallo/ triciclo metallo] [http://lakitsmi.freeweb7.com/web/hardisk-gb/ hardisk 160gb maxtor usb] [http://lamcgie.125mb.com/html/gold-miner.htm gold miner edition special] [http://nairoz.somee.com/img/styles/manfrotto-monopiede/ manfrotto monopiede] [http://trocterli.t35.com/img/styles/titanium-sky/ titanium sky] [http://thegoogly.somee.com/view/new/cap-d.htm cap d adge] [http://fergus-mac.somee.com/description/lib/xd-lettore/ xd lettore] [http://quotes-girl.somee.com/content/view/dsch-sony/ dsc-h1 sony] [http://madavid.t35.com/html/mp-scaricabili/ mp3 scaricabili] [http://lamcgie.125mb.com/html/dlink-dwlg.htm d-link dwl-g810] [http://madavid.t35.com/html/camera-avellino/ camera avellino] [http://kiboukni.125mb.com/web/corato/ corato] [http://jututor.125mb.com/lib/accessorio-gps/ accessorio gps] [http://madavid.t35.com/html/annuncio-incontri/ annuncio incontri perugia] [http://jedillar.125mb.com/resources/articles/try-nely/ try nely furtado] [http://kiboukni.125mb.com/web/sport-i/ sport i salti] [http://thegoogly.somee.com/view/new/depilazione-femminile.htm depilazione femminile] [http://quotes-girl.somee.com/content/view/import-export/ import export - agroalimentari] [http://jututor.125mb.com/lib/saylormoon-xxx/ saylormoon xxx] [http://lamcgie.125mb.com/html/ford-focus.htm ford focus 1.6 sw] [http://quotes-girl.somee.com/content/view/mochnacki-maurycy/ mochnacki, maurycy] [http://viemalin.freeweb7.com/resources/articles/i-s.htm i s p e l s] [http://nairoz.somee.com/img/styles/hotel-centro/ hotel centro firenze] [http://lakitsmi.freeweb7.com/web/helmut-lang/ helmut lang cuiron] [http://lensman.somee.com/html/il-classico/ il classico dei classici] [http://nairoz.somee.com/img/styles/dragostea-midi/ dragostea midi files] [http://dabeutle.t35.com/content/view/donne-cancun.htm donne cancun] [http://lakitsmi.freeweb7.com/web/albergo-economico/ albergo economico valencia] [http://lakitsmi.freeweb7.com/web/ati-radeon/ ati radeon 9600xt vivo 256mb] [http://fawarfo.freeweb7.com/topic/bastardo-dentro.htm bastardo dentro gioco sala] [http://madavid.t35.com/html/high-jinx/ high jinx] [http://yourorus.somee.com/data/prodotti-philips.htm prodotti philips] [http://luallard.t35.com/html/giornalista-ucciso/ giornalista ucciso] [http://viemalin.freeweb7.com/resources/articles/donna-visse.htm donna visse due] [http://betheresa.t35.com/text/directory/grafica-anni/ grafica anni 80] [http://viemalin.freeweb7.com/resources/articles/hanta.htm hanta] [http://itgurney.t35.com/view/new/nero-dvd/ nero dvd video warez] [http://brrezab.freeweb7.com/img/styles/sei-biaggio.htm sei biaggio antonacci] [http://thegoogly.somee.com/view/new/ltpp-j.htm ltpp j] [http://lamcgie.t35.com/web/porno-gallery.htm porno gallery] [http://luallard.t35.com/html/redding/ redding] [http://rihelm.125mb.com/img/styles/pagine-bianche/ pagine bianche pavia] [http://lensman.somee.com/html/renault-clio/ renault clio usata] [http://fergus-mac.somee.com/description/lib/verdi-giuseppe/ verdi giuseppe. la forza del destino] [http://itgurney.t35.com/view/new/porno-gratuiti/ porno gratuiti] [http://thegoogly.somee.com/view/new/cazzo-piu.htm cazzo piu lungo] [http://rihelm.125mb.com/img/styles/inculato-figlio/ inculato figlio] [http://itgurney.t35.com/view/new/intel-pentium/ intel pentium centrino] [http://jututor.125mb.com/lib/e-mon/ e mon fuck it] [http://luallard.t35.com/html/modulo-richiesta/ modulo richiesta anticipo liquidazione] [http://davelovesyou.somee.com/library/html/sacrifice-lisa/ sacrifice lisa gerrard pieter bourke] [http://ouquaite.freeweb7.com/img/styles/i-figli/ i figli di lusso] [http://trocterli.t35.com/img/styles/jessica-polsky/ jessica polsky] [http://nairoz.somee.com/img/styles/giulio-bedeschi/ giulio bedeschi] [http://dj-deus.somee.com/lib/acer-n.htm acer n30 destinator3] [http://kiboukni.125mb.com/web/alt-sex/ alt sex repository] [http://dabeutle.t35.com/content/view/riyadh-provincia.htm riyadh (provincia)] [http://rihelm.125mb.com/img/styles/unzicher/ unzicher] [http://nationavce.somee.com/library/html/turandot/ turandot] [http://davelovesyou.somee.com/library/html/heyjude/ heyjude] [http://thegoogly.somee.com/view/new/home-theatre.htm home theatre wifi] [http://dabeutle.t35.com/content/view/asus-a.htm asus a620 complete gps solution] [http://rihelm.125mb.com/img/styles/fumane/ fumane] [http://nationavce.somee.com/library/html/rivelazione-finale/ rivelazione finale] [http://peter-land.somee.com/images/small/sadiche.htm sadiche] [http://nationavce.somee.com/library/html/mario-allstars/ mario allstars] [http://nairoz.somee.com/img/styles/www-private/ www private com] [http://dj-deus.somee.com/lib/www-eros.htm www eros sat tv] [http://rihelm.125mb.com/img/styles/foto-porno/ foto porno con animali] [http://dabeutle.t35.com/content/view/kenwood-ddx.htm kenwood ddx7025] [http://betheresa.t35.com/text/directory/topolino-it/ topolino it] [http://coarmago.freeweb7.com/library/html/usb-hub.htm usb hub 2 0] [http://luallard.t35.com/html/digicom-switch/ digicom switch] [http://flheddina.t35.com/web/franks-adventur/ franks adventur 1] [http://luallard.t35.com/html/www-tunning/ www tunning com] [http://brrezab.freeweb7.com/img/styles/hawalli.htm hawalli] [http://lensman.somee.com/html/annuncio-inserzioni/ annuncio inserzioni] [http://coarmago.freeweb7.com/library/html/annunci-coppie.htm annunci coppie lombardia] [http://de-der.somee.com/library/html/zx-r.htm zx 10r] [http://flheddina.t35.com/web/x/ x5 4 4] [http://am-i-bird.somee.com/img/styles/tomtom-navigator.htm tomtom navigator 5 - bluetooth] [http://peter-land.somee.com/images/small/jade-empire.htm jade empire ha una data ufficiale] [http://quotes-girl.somee.com/content/view/cinque-matti/ cinque matti allo stadio] [http://fergus-mac.somee.com/description/lib/tacuba/ tacuba] [http://rihelm.125mb.com/img/styles/casse-studio/ casse studio] [http://fawarfo.freeweb7.com/topic/accessori-qtek.htm accessori qtek s100 batteria] [http://kiboukni.125mb.com/web/olio-merluzzo/ olio merluzzo] [http://dabeutle.t35.com/content/view/lanborghini.htm lanborghini] [http://quotes-girl.somee.com/content/view/sinpro/ sinpro] [http://luallard.t35.com/html/prada-profumo/ prada profumo donna] [http://nairoz.somee.com/img/styles/guida-con/ guida con gesso] [http://de-der.somee.com/library/html/lexmark-livin.htm lexmark livin 3000] [http://thegoogly.somee.com/view/new/gf-tedesco.htm gf5 tedesco] [http://dj-deus.somee.com/lib/kiara.htm kiara] [http://fergus-mac.somee.com/description/lib/www-maporama/ www maporama com] [http://dabeutle.t35.com/content/view/grupos-argentino.htm grupos argentino] [http://luallard.t35.com/html/www-phoo/ www phoo it] [http://kiboukni.125mb.com/web/divieti-di/ divieti di sosta] [http://am-i-bird.somee.com/img/styles/trans-europe.htm trans europe snc] [http://lakitsmi.freeweb7.com/web/schede-video/ schede video tv in] [http://nationavce.somee.com/library/html/notti-d/ notti d oriente] [http://fawarfo.freeweb7.com/topic/z.htm z510] [http://de-der.somee.com/library/html/this-love.htm this love marron five] [http://trocterli.t35.com/img/styles/monitor-/ monitor 19 sony] [http://am-i-bird.somee.com/img/styles/reggae-sunsplash.htm reggae sunsplash] [http://coarmago.freeweb7.com/library/html/dentro-scatola.htm dentro scatola mondo marcio] [http://fawarfo.freeweb7.com/topic/redco-srl.htm redco srl] [http://davelovesyou.somee.com/library/html/il-distintivo/ il distintivo di vetro] [http://madavid.t35.com/html/porno-porcate/ porno porcate] [http://flheddina.t35.com/web/dazai-osamu/ dazai osamu] [http://flheddina.t35.com/web/xeon-mp/ xeon mp intel] [http://am-i-bird.somee.com/img/styles/comune-di.htm comune di cento] [http://dj-deus.somee.com/lib/monitor-joytech.htm monitor joytech] [http://brrezab.freeweb7.com/img/styles/costa-carmelo.htm costa carmelo] [http://trocterli.t35.com/img/styles/monte-carlo/ monte carlo alberghi e hotel] [http://rimarsh.t35.com/images/small/inegi.htm inegi] [http://thegoogly.somee.com/view/new/tom-and.htm tom and jerry. viaggio intorno al mondo] [http://kiboukni.125mb.com/web/atacco-al/ atacco al castello] [http://lamcgie.t35.com/web/simulatori-wap.htm simulatori wap] [http://luallard.t35.com/html/aggiornamenti/ aggiornamenti] [http://yourorus.somee.com/data/medioevo-di.htm medioevo di marca] [http://rimarsh.t35.com/images/small/pastiglie-brembo.htm pastiglie brembo] [http://peter-land.somee.com/images/small/waves-of.htm waves of luv 2 black] [http://peter-land.somee.com/images/small/johnny-tiger.htm johnny tiger] [http://betheresa.t35.com/text/directory/lexus-rx/ lexus rx] [http://dj-deus.somee.com/lib/microonde-roadstar.htm microonde roadstar] [http://madavid.t35.com/html/orecchini-miluna/ orecchini miluna] [http://fawarfo.freeweb7.com/topic/bomberland.htm bomberland] [http://fawarfo.freeweb7.com/topic/palmare-gps.htm palmare gps wi-fi bluetooth] [http://trocterli.t35.com/img/styles/dlink-dpg/ d-link dp-g310] [http://fergus-mac.somee.com/description/lib/the-puppet/ the puppet] [http://nationavce.somee.com/library/html/oh-fiorentina/ oh fiorentina] [http://trocterli.t35.com/img/styles/magnex-/ magnex 40 tv] [http://flheddina.t35.com/web/belinea/ belinea 10 19 20] [http://betheresa.t35.com/text/directory/termometro-acqua/ termometro acqua] [http://ouquaite.freeweb7.com/img/styles/giornale-di/ giornale di sicilia enna] [http://jedillar.125mb.com/resources/articles/ecs-italia/ ecs italia] [http://lakitsmi.freeweb7.com/web/stefano-fiore/ stefano fiore] [http://lensman.somee.com/html/dali-vocal/ dali vocal] [http://ouquaite.freeweb7.com/img/styles/niuatoputapu/ niuatoputapu] [http://rimarsh.t35.com/images/small/tappeti-moderni.htm tappeti moderni milano] [http://fawarfo.freeweb7.com/topic/renga-video.htm renga video] [http://fawarfo.freeweb7.com/topic/zalman-zmnbj.htm zalman zm-nb47j] [http://lamcgie.125mb.com/html/adattatore-mp.htm adattatore mp3 per autoradio] [http://madavid.t35.com/html/zscech/ zscech] [http://trocterli.t35.com/img/styles/intimiano/ intimiano] [http://lakitsmi.freeweb7.com/web/cristina-capotondi/ cristina capotondi] [http://jututor.125mb.com/lib/emule-dowmload/ emule dowmload] [http://lamcgie.t35.com/web/telefilm-providence.htm telefilm providence] [http://de-der.somee.com/library/html/santangelo-concetta.htm santangelo concetta] [http://nairoz.somee.com/img/styles/dolce-e/ dolce e gabbana camicie donna] [http://nairoz.somee.com/img/styles/gerhardie-william/ gerhardie, william alexander] [http://ouquaite.freeweb7.com/img/styles/dvd-/ dvd - philips] [http://trocterli.t35.com/img/styles/larmes-de/ larmes de pluie] [http://fergus-mac.somee.com/description/lib/motorola-v/ motorola v220 drivers] [http://rimarsh.t35.com/images/small/vestito-corto.htm vestito corto] [http://dj-deus.somee.com/lib/fujifilm-mp.htm fujifilm mp-100] [http://itgurney.t35.com/view/new/dqsd/ dqsd] [http://trocterli.t35.com/img/styles/viacces-key/ viacces key s] [http://yourorus.somee.com/data/www-sansung.htm www sansung] [http://nationavce.somee.com/library/html/troei/ troei] [http://davelovesyou.somee.com/library/html/dtxpress-iii/ dtxpress iii special] [http://thegoogly.somee.com/view/new/viaggi-buenos.htm viaggi buenos aires argentina] [http://am-i-bird.somee.com/img/styles/esame-di.htm esame di stato] [http://itgurney.t35.com/view/new/nike-da/ nike da calcetto] [http://lamcgie.125mb.com/html/helder-rei.htm helder rei do kuduro] [http://dj-deus.somee.com/lib/www-campionato.htm www campionato europeo motocross it] [http://viemalin.freeweb7.com/resources/articles/phon-a.htm phon a ioni] [http://itgurney.t35.com/view/new/filmati-e/ filmati e dettagli per mega man x collection] [http://coarmago.freeweb7.com/library/html/viewtiful-joe.htm viewtiful joe] [http://ouquaite.freeweb7.com/img/styles/forni-da/ forni da incasso rex a vapore] [http://flheddina.t35.com/web/ghiochi-porno/ ghiochi porno] [http://rihelm.125mb.com/img/styles/nokia-/ nokia 6630 memory card] [http://lakitsmi.freeweb7.com/web/verga-novelle/ verga novelle] [http://flheddina.t35.com/web/come-preparare/ come preparare una lenza] [http://coarmago.freeweb7.com/library/html/ti-vengo.htm ti vengo] [http://rimarsh.t35.com/images/small/eve-feat.htm eve feat mary j blige] [http://dj-deus.somee.com/lib/mutaciones.htm mutaciones] [http://yourorus.somee.com/data/triumph-spitfire.htm triumph spitfire] [http://brrezab.freeweb7.com/img/styles/project-zero.htm project zero 2] [http://davelovesyou.somee.com/library/html/benq-fotocamera/ benq fotocamera] [http://dabeutle.t35.com/content/view/deskjet-c.htm deskjet 640c] [http://jututor.125mb.com/lib/royal-dutch/ royal dutch shell] [http://fawarfo.freeweb7.com/topic/jack.htm jack 2 5 3] [http://peter-land.somee.com/images/small/telecamera-per.htm telecamera per videosorveglianza] [http://jututor.125mb.com/lib/dj-rusch/ dj rusch] [http://dj-deus.somee.com/lib/spiaggie-perizoma.htm spiaggie perizoma] [http://peter-land.somee.com/images/small/anima-fondo.htm anima fondo investimento] [http://rimarsh.t35.com/images/small/bologna-timisoara.htm bologna timisoara] [http://betheresa.t35.com/text/directory/thermaltake-/ thermaltake - big water] {{Template:split-review}}
{{task}}
{{task}}


Line 65: Line 65:
char *p = (char *) string;
char *p = (char *) string;
while (*p != '\0') length ;
while (*p++ != '\0') length++;
return 0;
return 0;
Line 82: Line 82:
}
}


==[[C plus plus|C ]]==
==[[C plus plus|C++]]==
[[Category:C plus plus|C ]]
[[Category:C plus plus|C++]]


'''Standard:''' [[ISO C plus plus|ISO C ]] (AKA [[C plus plus 98|C 98]]):
'''Standard:''' [[ISO C plus plus|ISO C++]] (AKA [[C plus plus 98|C++98]]):


'''Compiler:''' g 4.0.2
'''Compiler:''' g++ 4.0.2


#include <string> // note: '''not''' <string.h>
#include <string> // note: '''not''' <string.h>
Line 114: Line 114:


'''Platform:''' [[.NET]]
'''Platform:''' [[.NET]]
'''Language Version:''' 1.0
'''Language Version:''' 1.0+


string s = "Hello, world!";
string s = "Hello, world!";

Revision as of 15:43, 22 August 2007

This task has has been split off from another task. Its programming examples are in need of review to ensure that they fit the requirements of the new task.
Task
String Byte Length
You are encouraged to solve this task according to the task description, using any language you may know.

In this task, the goal is to find the byte length of a string. This means encodings like UTF-8 may need to be handled specially, as there is not necessarily a one-to-one relationship between bytes and characters, and some languages recognize this.

For character length, see String Character Length.

4D

$length:=Length("Hello, world!")

ActionScript

myStrVar.length()

Ada

Compiler: GCC 4.1.2

Str    : String := "Hello World";
Length : constant Natural := Str'Length;

AppleScript

count of "Hello World"

AWK

From within any code block:

w=length("Hello, world!")      # static string example
x=length("Hello," s " world!") # dynamic string example
y=length($1)                   # input field example
z=length(s)                    # variable name example

Ad hoc program from command line:

echo "Hello, world!" | awk '{print length($0)}'

From executable script: (prints for every line arriving on stdin)

#!/usr/bin/awk -f
{print"The length of this line is "length($0)}

C

Standard: ANSI C (AKA C89):

Compiler: GCC 3.3.3

 #include <string.h>

 int main(void) 
 {
   const char *string = "Hello, world!";
   size_t length = strlen(string);
          
   return 0;
 }

or by hand:

 int main(void) 
 {
   const char *string = "Hello, world!";
   size_t length = 0;
   
   char *p = (char *) string;
   while (*p++ != '\0') length++;                                         
   
   return 0;
 }

or (for arrays of char only)

 #include <stdlib.h>
 
 int main(void)
 {
   char const s[] = "Hello, world!";
   size_t length = sizeof s - 1;
   
   return 0;
 }

C++

Standard: ISO C++ (AKA C++98):

Compiler: g++ 4.0.2

 #include <string> // note: not <string.h>
 
 int main()
 {
   std::string s = "Hello, world!";
   std::string::size_type length = s.length(); // option 1: In Characters/Bytes
   std::string::size_type size = s.size();     // option 2: In Characters/Bytes
   // In bytes same as above since sizeof(char) == 1
   std::string::size_type bytes = s.length() * sizeof(std::string::value_type); 
 }

For wide character strings:

 #include <string>
 
 int main()
 {
   std::wstring s = L"\u304A\u306F\u3088\u3046";
   std::wstring::size_type length = s.length() * sizeof(std::wstring::value_type); // in bytes
 }

C#

Platform: .NET Language Version: 1.0+

string s = "Hello, world!";
int clength = s.Length;  // In characters
int blength = System.Text.Encoding.GetBytes(s).length; // In Bytes.

Clean

Clean Strings are unboxed arrays of characters. Characters are always a single byte. The function size returns the number of elements in an array.

import StdEnv

strlen :: String -> Int
strlen string = size string 

Start = strlen "Hello, world!"

ColdFusion

  #len("Hello World")#

Common Lisp

  (length "Hello World")

Component Pascal

  LEN("Hello, World!")

Forth

Interpreter: ANS Forth

 CREATE s ," Hello world" \ create string "s"
 s C@ ( -- length )

Haskell

Interpreter: GHCi 6.6, Hugs

Compiler: GHC 6.6

strlen = length "Hello, world!"

IDL

Compiler: any IDL compiler should do

 length = strlen("Hello, world!")

Java

Java encodes strings in UTF-16, which represents each character with one or two 16-bit values. The length method of String objects returns the number of 16-bit values used to encode a string, so the number of bytes can be determined by doubling that number.

String s = "Hello, world!";
int byteCount = s.length() * 2;

An other way to know the byte length of a string is to explicitly specify the charset we desire.

String s = "Hello, world!";
int byteCountUTF16 = s.getByte("UTF-16").length;
int byteCountUTF8  = s.getByte("UTF-8").length;

JavaScript

JavaScript encodes strings in UTF-16, which represents each character with one or two 16-bit values. The length property of string objects gives the number of 16-bit values used to encode a string, so the number of bytes can be determined by doubling that number.

var s = "Hello, world!";
var byteCount = s.length * 2; //26

JudoScript

 //Store length of hello world in length and print it
 . length = "Hello World".length();

Lua

Interpreter: Lua 5.0 or later.

 string="Hello world"
 length=#string

mIRC Scripting Language

Interpreter: mIRC

alias stringlength { echo -a Your Name is: $len($$?="Whats your name") letters long! }

OCaml

Interpreter/Compiler: Ocaml 3.09

String.length "Hello world";;


Perl

Interpreter: perl 5.8

Strings in Perl consist of characters. Measuring the byte length therefore requires conversion to some binary representation (called encoding, both noun and verb).

use utf8; # so we can use literal characters like ☺ in source
use Encode qw(encode);

print length encode 'UTF-8', "Hello, world! ☺";
# 17. The last character takes 3 bytes, the others 1 byte each.

print length encode 'UTF-16', "Hello, world! ☺";
# 32. 2 bytes for the BOM, then 15 byte pairs for each character.

PHP

 $length = strlen('Hello, world!');

PL/SQL

DECLARE
  string VARCHAR2( 50 ) := 'Hello, world!';
  stringlength NUMBER;
BEGIN
  stringlength := length( string );
END;

Pop11

Currently Pop11 supports only strings consisting of 1-byte units. Strings can carry arbitrary binary data, so user can for example use UTF-8 (however builtin procedures will treat each byte as a single character). The length function for strings returns length in bytes:

lvars str = 'Hello, world!';
lvars len = length(str);

Python

Interpreter: Python 2.4

length = len("The length of this string will be determined")

Ruby

 string="Hello world"
 print string.length

or

 puts "Hello World".length

Scheme

 (string-length "Hello world")

Smalltalk

 string := 'Hello, world!".
 string size.

Standard ML

Interpreter: SML/NJ 110.60, Moscow ML 2.01 (January 2004)

Compiler: MLton 20061107

val strlen = size "Hello, world!";

Tcl

Basic version:

 string bytelength "Hello, world!"

or more elaborately, needs Interpreter any 8.X. Tested on 8.4.12.

 fconfigure stdout -encoding utf-8; #So that Unicode string will print correctly
 set s1 "hello, world"
 set s2 "\u304A\u306F\u3088\u3046"
 puts [format "length of \"%s\" in bytes is %d"  $s1 [string bytelength $s1]]
 puts [format "length of \"%s\" in bytes is %d"  $s2 [string bytelength $s2]]

Toka

This will include the terminating 0 in the length.

 " hello, world!" count 

UNIX Shell

With external utilities:

Interpreter: any bourne shell

 string='Hello, world!'
 length=`echo -n "$string" | wc -c | tr -dc '0-9'`
 echo $length # if you want it printed to the terminal

With SUSv3 parameter expansion modifier:

Interpreter: Almquist SHell (NetBSD 3.0), Bourne Again SHell 3.2, Korn SHell (5.2.14 99/07/13.2), Z SHell

 string='Hello, world!'
 length="${#string}"
 echo $length # if you want it printed to the terminal


VBScript

LenB(string|varname) 

Returns the number of bytes required to store a string in memory Returns null if string|varname is null

xTalk

Interpreter: HyperCard

 put the length of "Hello World"

or

 put the number of characters in "Hello World"