<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div>There is no explicit function that does this. You will have to write your own. I suggest creating two 26-member arrays, one for each case, as follows:<br><br></div>lowercase.1 = 'a'<br></div><div>lowercase.2 = 'b'<br></div><div>lowercase.3 = 'c'<br>...<br>...<br>...<br></div><div>lowercase.26 = 'z'<br></div><div>uppercase.1 = "A"<br></div><div>uppercase.2 = "B"<br></div><div>uppercase.3 = "C"<br>...<br>...<br>...<br></div><div>uppercase.26 = "Z"<br><br></div></div>When converting case in your input string, you need to assign a number associated with the location of that number in the above arrays. Ex: c = 3, t = 20. Since you cannot substitute individual string elements, you'll have to build up a new string using a loop, switching the specific positions you want to switch. You'll have to create a swap array to do this. Something like<br></div>swap.1 = 1<br></div>swap.2 = 0<br></div>swap.3 = 0<br></div>could work, and would tell the program to swap the case of only the first element (character).<br><br></div>This is clearly pretty intense, so you may want to just build a shortcut if you know there is a limit to the types of strings you want to replace. If all you're doing is months, you can do something as simple as<br><br></div>if (inituppermonth = "JAN")<br></div> initlowermonth = "Jan"<br></div>endif<br></div>if (inituppermonth = "FEB")<br> initlowermonth = "Feb"<br>endif<br>if (inituppermonth = "MAR")<br> initlowermonth = "Mar"<br>endif<br>...<br>...<br>...<br><br></div>Jeff Duda<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 22, 2017 at 6:05 PM, Charlie Phillips <span dir="ltr"><<a href="mailto:charliep127@hotmail.com" target="_blank">charliep127@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_-5845984683594956667divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif" dir="ltr">
<p>Hello grads users,</p>
<p><br>
</p>
<p>I am trying to change part of a string to lowercase. Is there was any way to do this in Grads?</p>
<p><br>
</p>
<p>Specifically, I am trying to change the month string from the "q time" command to begin with an uppercase letter only instead of having it all uppercase - ex: I want to change MAR to Mar.</p>
<p><br>
</p>
<p>Here's a sample piece of code... obviously it's missing the conversion to lowercase.<br>
</p>
<p><br>
</p>
<p></p>
<div>'q time'<br>
<br>
inituppermonth=substr(result, 13, 1)<br>
initlowermonth=substr(result, 14, 2)<br>
'define initmonth='%inituppermonth' '%initlowermonth<br>
</div>
<p></p>
<p><br>
</p>
<p>Thank you!</p>
<p><br>
</p>
</div>
</div>
<br>______________________________<wbr>_________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/<wbr>listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Jeff Duda<br>Post-doctoral research fellow<br>University of Oklahoma School of Meteorology<br></div></div></div></div></div>
</div>