2025-12-27, Saturday 2h 25 am
Here is an interesting piece of code: The program looks for the small case letter that comes after each * and space and changes it to an upper case letter.
# --- CAPITALIZE LETTER AFTER STAR + SPACE --------------------------
#
set final_lines_capitalized {}
foreach line $final_lines {
# Find the star and the space after it
if {[regexp {^\* (\w)} $line -> star space first_letter]} {
set capitalized_letter [string toupper $first_letter]
# Replace the first letter after * and space with uppercase
regsub {^\* (\w)} $line "* $capitalized_letter" new_line
lappend final_lines_capitalized $new_line
} else {
lappend final_lines_capitalized $line
}
}Interesting! If anyone wants to explain this code more, please be my guest.
CGM I would suggest using lmap and regsub -command for a neater solution.
gold 12/27/2025. Added categories, so can find this Wiki page in Wiki.
| Category Numerical Analysis | Category Toys | Category Calculator | Category Mathematics | Category Example | Toys and Games | Category Games | Category Application | Category GUI |