screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <div id="app"> <h3>Vue Get string Before specific character</h3> <p>Original string: {{ myString }}</p> <p>Substring Before Pipline: {{ getSubstring(myString) }}</p> </div> <script type="module"> const app = Vue.createApp({ data() { return { myString: 'Before Pipeline String | After Pipeline String' }; }, methods: { getSubstring(str) { return str.split('|')[0]; // Returns the first element before splitting by '|' } } });app.mount("#app"); </script> </body> </html>