But to understand the Format operator a little bit more, it would be useful to understand how choice formats works in Active4D. And if there are more features from the ICU Library which could be useful there.

The Active4D docs point to the general message format page:

http://icu-project.org/apiref/icu4c/classMessageFormat.html

The important part is a little down, after "The pattern is of the following form. Legend:".


$format:="<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>"

write($format %% ( "abc";"";"xyz" )) //-> "<tr><td>abc</ td><td>-</td><td>xyz</td></tr>"

The condition is: IF value is empty take  "-" ELSE take the value.


$format := "<tr><td>{0,choice,0#-|0<{1}}</td><td>{2,choice,2#-|2<{3}}</ td><td>{4,choice,4#-|4<{5}}</td></tr>"
$a := "abc"
$b := "def"
$c := ""

write($format %% (length($a); $a; length($b); $b; length($c); $c))

Please read the ICU documentation a few times and try to figure out what is going on before asking for more help. It took me a few times reading the documentation and playing around with the formats to figure out how they worked.

Kind regards,

   Aparajita
   www.aparajitaworld.com

   "If you dare to fail, you are bound to succeed."
   - Sri Chinmoy   |   www.srichinmoy.org

_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to