You gave us no indication where the original email string was coming from (a memory variable or a table field??) nor where the result was to go into (another memory variable or another table field???).
And you neglected to let us know that you wanted to do this as a one-line command rather than using a record-by-record processing loop such as SCAN/ENDSCAN.
And mmerlin's comments above are accurate should you have email addresses such as Something@xxx.tv or other similar addresses. If so the "+3" approach will not work.
I would have hoped that somewhere back in high school Algebra you were shown how to replace portions of an equation with other pre-defined equivalencies.
AB = "ABC"
CD = "1234"
XYZ = AB + "-" + CD
by using equivalency replacements you can see that the above XYZ is the same as
XYZ = "ABC" + "-" + "1234"
You could have used that principle on what was suggested above to end up with something like the following:
Code:
REPLACE NewField WITH LEFT(EmailField, (AT(".", EmailField) + 3))
BTW: mc, mn, and other variable prefixes are merely part of variable naming standards used to help the code reader understand what type of value the variable is intended to contain.
Admittedly, most people no longer use the "m" part of it, but I still cling to it to definitively indicate to others that I am referencing a Memory variable instead of a table field or other object. I guess that for me it is a hard-to let-go-of hold-over from the old "m." days.
So when you see a
mcSomething or a cSomething it implies that it is a Memory variable containing a String value.
mnSomething or a nSomething ==> memory variable - Numeric
mdSomething or a dSomething ==> memory variable - Date
Good Luck,
JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com