rtrim jde c api equivilant

nkuebelbeck

VIP Member
I've used rtrim in NER before and it appears to work. Looking at the c code it generates it gets messy. Is there a shipped JDE C api to trim leading/trailing white space?

I need to take two values and strncat them together, but the last string i'm trying to cat is a data structure dd value retrieved from a table and it appears right padded with spaces.

to prevent any overflows i'm trying this

jdeStrncat(dsF4108Update.iorlot,dsF4108.iorlot,DIM(dsF4108Update.iorlot) - jdeStrlen(dsF4108.iorlot) - 1);

the value is not being appended and i believe it because it's length is 30 already

EDIT

searching through some source i see an internal function whenever this is required

/**************************************************************************
* Function: I0800283_RightTrimSpaces
*
* Notes: This internal function will remove spaces on the right of the
* null-terminated string.
*
* Returns: NONE
*
* Parameters:
**************************************************************************/
static void I0800283_RightTrimSpaces(JCHAR *szString)
{
int iLength = 0;

iLength = jdeStrlen( szString );
while ( iLength > 0 && *(szString+iLength-1) == _J(' ') )
{
*(szString+(--iLength)) = _J('\0');
}
return;
}
 
Last edited:

nkuebelbeck

VIP Member
I've used rtrim in NER before and it appears to work. Looking at the c code it generates it gets messy. Is there a shipped JDE C api to trim leading/trailing white space?

I need to take two values and strncat them together, but the last string i'm trying to cat is a data structure dd value retrieved from a table and it appears right padded with spaces.

to prevent any overflows i'm trying this

jdeStrncat(dsF4108Update.iorlot,dsF4108.iorlot,DIM(dsF4108Update.iorlot) - jdeStrlen(dsF4108.iorlot) - 1);

the value is not being appended and i believe it because it's length is 30 already

EDIT

searching through some source i see an internal function whenever this is required

/**************************************************************************
* Function: I0800283_RightTrimSpaces
*
* Notes: This internal function will remove spaces on the right of the
* null-terminated string.
*
* Returns: NONE
*
* Parameters:
**************************************************************************/
static void I0800283_RightTrimSpaces(JCHAR *szString)
{
int iLength = 0;

iLength = jdeStrlen( szString );
while ( iLength > 0 && *(szString+iLength-1) == _J(' ') )
{
*(szString+(--iLength)) = _J('\0');
}
return;
}

figured this out. thanks all
 

nkuebelbeck

VIP Member
nope, used an internal function

static void YourBSFNName_RightTrimSpaces(JCHAR *szString)
{
int iLength = 0;

iLength = jdeStrlen( szString );
while ( iLength > 0 && *(szString+iLength-1) == _J(' ') )
{
*(szString+(--iLength)) = _J('\0');
}
return;
}
 

craig_welton

Legendary Poster
I believe I came across them in some existing functions. Check out the system header files as well, plenty of nuggets in there.

Craig
 
Hi All,

I want to add with Craig posted on 05-12-2015.
1.
jdeStripTrailingBlanks - It will remove blank spaces from trailing edge.
2. jdeStripBlanks - It will remove Blank spaces from leading and trailing edge and also it will remove blank spaces in between words.
3.
jdeRemoveLeadingAndTrailingSpaces - The names looks like to remove both leading and trailing blank spaces, but it will removes only blank spaces from trailing edge.

Please make sure that the place where you gonna use these API's.

Thanks.

 
Top