IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Page 1 of 2 1 2 >
Topic Options
#35056 - 02/21/11 04:22 PM Capitalizing an Address Field
Joel McLaughlin Offline
OL Newbie

Registered: 01/14/11
Posts: 8
We have some data coming down in the print stream that is not capitalized that we would like to capitalize using Planet Press without changing the program sending the output. Can this be done??

Top
#35057 - 02/21/11 04:44 PM Re: Capitalizing an Address Field [Re: Joel McLaughlin]
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
Joel,

Check out our custom "string" functions on our web site:
http://www.objectiflune.com/OL/en-CA/Dow...Cat=PressTalk#1

We have one called "SentenceCase". If you use this function, it will properly capitalize the selected data. So you could use:

=@SentenceCase(@(1,1,100))

This would properly capitalize the data that is on the data selection(in this case, line 1, from column 1 to 100).

Hope that helps!

Regards,
Raphaël Lalonde Lefebvre

Top
#35177 - 03/04/11 09:07 AM Re: Capitalizing an Address Field [Re: Raphael Lalonde Lefebvre]
JulieK Offline
OL Newbie

Registered: 02/23/11
Posts: 7
Loc: Tampa, FL
Raphael,
The SentenceCase does work well, but what would you suggest to make sure that the directionals remain capital? Example NW, NE, SW, SE, etc.

Thank you in advance
Julie

Top
#35180 - 03/04/11 10:34 AM Re: Capitalizing an Address Field [Re: JulieK]
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
Julie,

This can be done by adding an exception for when it encounters a directional. For example, try this modified version of the function:

Code:
function @SentenceCase(&Param: string): string
  %---------------------------------------------------------
  % Function that changes the cases of the characters in   -
  % a string to output the string like a sentence (first   -
  % letter of every sentence in uppercase).                -
  %---------------------------------------------------------
  % Input:  &Param       String to convert.                -
  % Output: Converted string looking like a sentence.      -
  % Uses:   None.                                          -
  %---------------------------------------------------------
  % Written by:   Marty Jacques, Objectif Lune             -
  % Last updated: November 10, 2004                        -
  % Modified by Raphaël to handle directionals.            -
  %---------------------------------------------------------
  define(&i,integer,0)
  define(&p,integer,0)
  define(&bStartSentence,boolean,true)
  define(&Work,string,'')
  define(&Upper,string,'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÂÄÉÈÊËÌÎÏÒÔÖÙÛÜÇ')
  define(&Lower,string,'abcdefghijklmnopqrstuvwxyzàâäéèêëìîïòôöùûüç')
  for(&i,1,1,length(&Param))
    if(pos(mid(&Param,&i,1),'.;:!?')>0)
      &bStartSentence:=true
    endif
    if(&bStartSentence)
      %Need uppercase
      &p:=pos(mid(&Param,&i,1),&Lower)

      % Handle directionals.
      if(pos(mid(&Param,&i,2), 'NW|SW|NE|SE') > 0)
        set(&Work,&Work + mid(&Param,&i,2))
        &i := &i + 1
      elseif()
        if(&p>0)
          set(&Work,&Work + mid(&Upper,&p,1))
        elseif()
          set(&Work,&Work + mid(&Param,&i,1))
        endif()
      endif()

      if(&bStartSentence and (pos(mid(&Param,&i,1),'.;:!?_ ')=0))
        &bStartSentence:=false
      endif
    elseif()
      %Need lowercase
      &p:=pos(mid(&Param,&i,1),&Upper)

      % Handle directionals.
      if(pos(mid(&Param,&i,2), 'NW|SW|NE|SE') > 0)
        set(&Work,&Work + mid(&Param,&i,2))
        &i := &i + 1
      elseif()
        if(&p>0)
          set(&Work,&Work + mid(&Lower,&p,1))
        elseif()
          set(&Work,&Work + mid(&Param,&i,1))
        endif()
      endif()

    endif()
  endfor()
  &Result:=&Work
endfunction()


This adds exceptions for NW, NE, SW and SE so that it will not alter the case of these two letter combinations.

Hope that helps!

Regards,
Raphaël Lalonde Lefebvre

Top
#35243 - 03/11/11 12:12 PM Re: Capitalizing an Address Field [Re: Raphael Lalonde Lefebvre]
JulieK Offline
OL Newbie

Registered: 02/23/11
Posts: 7
Loc: Tampa, FL
Raphael,
I copied and pasted the code to make sure I didn't make a mistake. I'm coming up with strange results. The directionals are indeed still capials however, if those letters are in the middle of a word they are also capital. Example: GaiNEsvillE.
Also the rest of the address is now lower case. Do I need to daisy chain functions together??? I'm clearly missing something.
Thank you again for your help!!
Julie

Top
#35283 - 03/16/11 01:51 PM Re: Capitalizing an Address Field [Re: JulieK]
Joel McLaughlin Offline
OL Newbie

Registered: 01/14/11
Posts: 8
How do you work with the Planet Press Talk Libraries? I have the Library how do I import it??

Top
#35285 - 03/16/11 02:04 PM Re: Capitalizing an Address Field [Re: Joel McLaughlin]
Joel McLaughlin Offline
OL Newbie

Registered: 01/14/11
Posts: 8
Also, I want EVERY character capitalized....for example:

Input:

Joel McLaughlin
123 Anystreet St
Anytown, OH 89511

Output:

JOEL MCLAUGHLIN
123 ANYSTREET ST
ANYTOWN, OH 89511

Top
#35286 - 03/16/11 02:48 PM Re: Capitalizing an Address Field [Re: Joel McLaughlin]
Joel McLaughlin Offline
OL Newbie

Registered: 01/14/11
Posts: 8
Should I be using UpperCaseFR? How do I call it??

Top
#35287 - 03/16/11 02:58 PM Re: Capitalizing an Address Field [Re: Joel McLaughlin]
Eric Lachance
Unregistered


Joel,

You can simply use the uppercase() function since you don't need to do fancy things like capitalize the first letter of every word or a sentence. So, in your Address object, in your line where you do your data selections, just wrap your data selection in uppercase(). Example:

Code:
=uppercase(@(1,1,50))


Reference: PlanetPress Talk REference Guide

Top
#35289 - 03/16/11 04:25 PM Re: Capitalizing an Address Field [Re: ]
DaleM Offline
OL Newbie

Registered: 03/16/11
Posts: 1
Loc: Columbus OH
This isn't Joel, it's Dale. Joel and I have been working on this together. This example was exactly what we needed! Worked just like we planned.

Thanks for the help, Eric.

Top
Page 1 of 2 1 2 >