----------------------------------------------------------------------------------------------------------------------------------
SHIFTing- is likely to repositioning the string.
In ABAP - Left shift, Right Shift and circular left and circular right shift.
Step1. Code
-----------------------------------------------------------------------------------------------------------------------
" SHIFTING "
DATA : str1 TYPE string VALUE 'SAP ABAP PROGRAM',
str2 TYPE string VALUE 'SAP ABAP PROGRAM',
str3 TYPE string VALUE 'SAP ABAP PROGRAM',
str4 TYPE string VALUE 'SAP ABAP PROGRAM',
str5 TYPE string VALUE 'SAP ABAP PROGRAM'.
" Left Shift
WRITE :/ 'Before Left Shift:', str1.
SHIFT str1 LEFT BY 3 PLACES.
WRITE :/ 'After Left Shift:', str1.
ULINE.
" Right Shift
WRITE :/ 'Before Right Shift:', str2.
SHIFT str2 RIGHT BY 3 PLACES.
WRITE :/ 'After right Shift:', str2.
ULINE.
" SHIFT upto a substring
WRITE :/ 'Before Shift upto a substring',str3 .
SHIFT str3 UP TO 'ABAP'.
WRITE :/ 'After shift upto a substrung',str3 .
ULINE.
" Circular Shift- Left
" by default it is left circular shift
WRITE :/ 'Before left circular Shift:', str4.
"SHIFT str4 CIRCULAR BY 3 PLACES.
SHIFT str4 LEFT CIRCULAR BY 3 PLACES.
WRITE :/ 'After left circular Shift:', str4.
ULINE.
" Circular Shift-Right
WRITE :/ 'Before right circular Shift:', str5.
SHIFT str5 RIGHT CIRCULAR BY 3 PLACES.
WRITE :/ 'After right circular Shift:', str5.
ULINE.
--------------------------------------------------------------------------------------------------------------------------
Step2. Here is the output!
----------------------------------------------------------------------------------------------------------------------------------
SHIFTing- is likely to repositioning the string.
In ABAP - Left shift, Right Shift and circular left and circular right shift.
Step1. Code
-----------------------------------------------------------------------------------------------------------------------
" SHIFTING "
DATA : str1 TYPE string VALUE 'SAP ABAP PROGRAM',
str2 TYPE string VALUE 'SAP ABAP PROGRAM',
str3 TYPE string VALUE 'SAP ABAP PROGRAM',
str4 TYPE string VALUE 'SAP ABAP PROGRAM',
str5 TYPE string VALUE 'SAP ABAP PROGRAM'.
" Left Shift
WRITE :/ 'Before Left Shift:', str1.
SHIFT str1 LEFT BY 3 PLACES.
WRITE :/ 'After Left Shift:', str1.
ULINE.
" Right Shift
WRITE :/ 'Before Right Shift:', str2.
SHIFT str2 RIGHT BY 3 PLACES.
WRITE :/ 'After right Shift:', str2.
ULINE.
" SHIFT upto a substring
WRITE :/ 'Before Shift upto a substring',str3 .
SHIFT str3 UP TO 'ABAP'.
WRITE :/ 'After shift upto a substrung',str3 .
ULINE.
" Circular Shift- Left
" by default it is left circular shift
WRITE :/ 'Before left circular Shift:', str4.
"SHIFT str4 CIRCULAR BY 3 PLACES.
SHIFT str4 LEFT CIRCULAR BY 3 PLACES.
WRITE :/ 'After left circular Shift:', str4.
ULINE.
" Circular Shift-Right
WRITE :/ 'Before right circular Shift:', str5.
SHIFT str5 RIGHT CIRCULAR BY 3 PLACES.
WRITE :/ 'After right circular Shift:', str5.
ULINE.
--------------------------------------------------------------------------------------------------------------------------
Step2. Here is the output!
----------------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment