Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
6650 Lượt xem

I want to replace the dot (.) with comma (,) and the comma with colon, that's it, a swap of the characters.


Is there any swap function in QWeb?

Ảnh đại diện
Huỷ bỏ
Tác giả

I meant to say:

I want to replace the dot (.) with comma (,) and the comma with dot, that's it, a swap of the characters.

I don't know why I cannot edit my own post...

Câu trả lời hay nhất

use python string.replace in t-raw, watch for the order.

....

<t t-raw="'this string includes . , . , . '.replace(',',':').replace('.' , ',')" />

...

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks, but that's exactly what am I doing, with an extra intermediate replace. I want to know if there is a swap function to avoid the 3 calls to replace function.

nope. unless you add it yourself.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 10 23
3014
2
thg 7 23
6324
1
thg 6 23
4332
1
thg 4 23
5049
1
thg 11 22
3762