how to retrieve URL from fragment "A" to fragment "B" and fragment "B" is a (Webview)? - webview

I have created one activity which has two fragments.
Fragment "A" which contains buttons with urls.
Fragment "B" which contain webview.
I want to retrieve url from fragment "A" to "B".
please help me share complete code.
thankyou
tried nothing before because i am a noob

Related

Segment Builder - Any way to 'paste' in multiple URLs (due to varying name conventions/etc)?

I'm trying to build a couple of segments based on entry url. Unfortunately, the site has inconsistent name conventions/url structures so using 'Starts With' or some of the other search operators isn't much help. Is there a way to 'paste' (and use a separator) a list of various entry urls or am I going to have to do this one by one?
Current (inefficient)
::Entry URL = URL 1 OR Entry URL = URL 2, etc..
Hoping for (more efficient)
:Entry URL matches any of these: URL1, URL2, etc (pasted in single field?)
Thanks for any help!
Use match type "matches regex" and list your values with "|" in one field.
URL1|URL2

Character encoding inside amp-bind

My code is here.
I am having issues with the ã character when filtering an amp-state.
I have two states, menu (which I cannot edit becaues is external and will come from a JSON API) and selection (updated with user's selection)
In the last line I want to filter the menu state with the two parameters that the user selects. However the ã character is not being recognize and is problematic. If I remove all the ã from menu state and then I filter by Impressao then it works. But unfortunately, the menu state is something I cannot change.
Thanks!
To solve this you can use bracket notation instead of dot notion in your expression, both will pass AMP validation.
<p [text]="'Length of filtered Array: ' + menu.array.filter(pos =>
pos.Tamanho == selection.Tamanho
&&
pos['Impressão'] == selection['Impressao']
).length">Length of filtered Array: ?</p>
Here's a working fiddle.

How do I grab all the content from within [url] including square brackets and match group 1 and 2

I have this regular expression
/\[url=(?:")?(.*?)(?:")?\](.*?)\[\/url\]/mi
and these blocks of text
[url=/someurl?page=5#3467]First[/url][postquote=true]
[url=/another_url/who-is?page=4#3396] Second[/url]
Some text[url=/another_url/who-is?page=3][i]3[/i] Third [/url]
and the regex works great at extracting the urls and text between the urls
Match 1
1. /someurl?page=5#3467
2. First
Match 2
1. /another_url/who-is?page=4#3396
2. Second
Match 3
1. /another_url/who-is?page=3
2. [i]3[/i] Third
The problem happens when I use the same regex from above to try to extract the url from this text
This is some text [url=https://www.somesite.com/location/?opt[]=apples]Link Name[/url]
Match 1
1. https://www.somesite.com/location/?opt[
2. =apples]Link Name
Notice the =apples] in the second match. What I need is the matched first match to include that in the url like
https://www.somesite.com/location/?opt[]=apples
Link Name
I have tried many modifications to this regex and no go so far, any help would be appreciated.
Ruby regex has the duplicate named capture feature. With this feature, you can handle the two cases easily (the one with &quote; and the other). You don't have to use a recursive pattern since I doubt that [] can be nested in the query part of a url:
/\[url=(?:&quote;(?<url>[^&]*(?:&(?!quote;)[^&]*)*)&quote;|(?<url>[^\s\]\[]*(?:\[\][^\s\]\[]*)*))\](?<text>.*?)\[\/url\]/mi
the url is in the named group url and the content between tags is in the named group text.
in a more readable format:
/
\[url=
(?:
&quote; (?<url> [^&]* (?:&(?!quote;)[^&]*)* ) &quote;
|
(?<url> [^\s\]\[]* (?:\[\][^\s\]\[]*)* )
)
\]
(?<text>.*?)\[\/url\]
/mix

Suppress delimiters in Ruby's String#split

I'm importing data from old spreadsheets into a database using rails.
I have one column that contains a list on each row, that are sometimes formatted as
first, second
and other times like this
third and fourth
So I wanted to split up this string into an array, delimiting either with a comma or with the word "and". I tried
my_string.split /\s?(\,|and)\s?/
Unfortunately, as the docs say:
If pattern contains groups, the respective matches will be returned in the array as well.
Which means that I get back an array that looks like
[
[0] "first"
[1] ", "
[2] "second"
]
Obviously only the zeroth and second elements are useful to me. What do you recommend as the neatest way of achieving what I'm trying to do?
You can instruct the regexp to not capture the group using ?:.
my_string.split(/\s?(?:\,|and)\s?/)
# => ["first", "second"]
As an aside note
into a database using rails.
Please note this has nothing to do with Rails, that's Ruby.

How to remove the trailing comma & space in a for-each loop that generates links in a mvc vbhtml view?

Given a loop like:
#For Each x In item.PostCategory
Dim cats = x.CategoryName & ", "
#Html.ActionLink(cats,
"PostsByCategory", "Posts", New With {.Category = x.CategoryName.ToSeoUrl,
.Page = Nothing}, Nothing)
Next
I need to remove only the last comma and space - everything I have tried removes the commas and spaces in the middle as well as the end. The loop renders categories and I want them separated by a comma and space but do not need or want the trailing comma and space. Each category needs to be a separate link so string.join won't work. I tried trim.substring - that removes the commas in the middle. TrimEnd did not work. I have searched and have not found a solution.
Instead of World, Science, - i want World, Science
You can try to check if x is the last item in PostCategory. If it is true, then append an empty string, else append comma and space :
Dim cats = x.CategoryName & IIf(x.Equals(item.PostCategory.Last()), "", ", ")
There's many different ways to solve this problem. You'll have to determine the best way. Simply, you can just not use a foreach and do a simple for instead. Then you can easily tell if you're on the last item by comparing the index with the count and conditional show or not show the comma based on that.
Alternatively, you can construct a list of the string values this code would otherwise render directly to the page and then use string.Join to join the list items separated by ", ". string.Join never appends the delimiter to the end, so that fixes your problem.
You could also go fancier with some sort of editor template or partial view or even create a HtmlHelper extension. If just depends on how you want to handle it.

Resources